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

Upgradeable Module Registry #265

Merged
merged 26 commits into from
Sep 27, 2018
Merged

Upgradeable Module Registry #265

merged 26 commits into from
Sep 27, 2018

Conversation

satyamakgec
Copy link
Contributor

@satyamakgec satyamakgec commented Sep 19, 2018

Please check if the PR fulfills these requirements

  • The commit message follows our Submission guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

(Bug fix, feature, docs update, ...)
make upgradeable ModuleRegistry

What is the current behavior?

(You can also link to an open issue here)
#206

What is the new behavior?

(Define and describe any new functionality. Clarify if this is a feature change)

Does this PR introduce a breaking change?

(What changes might users need to make in their application due to this PR?)

Any Other information:

library VersionUtils {

/**
* @notice This function use to validate the inputted version
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is used to validate the version submitted

@satyamakgec satyamakgec changed the title WIP: Upgradeable Module Registry Upgradeable Module Registry Sep 26, 2018
@satyamakgec
Copy link
Contributor Author

@adamdossa @pabloruiz55 please review it closely.
Changes:

  • Upgradeable MR

  • Proxy Factory logic for the USDTieredSTO

  • Version implementation related to modules

require(registry[_moduleFactory] != 0, "ModuleFactory type should not be 0");
reputation[_moduleFactory].push(msg.sender);
emit LogModuleUsed(_moduleFactory, msg.sender);
uint8[] memory _latestVersion = ISecurityTokenRegistry(getAddress(Encoder.getKey('securityTokenRegistry'))).getProtocolVersion();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be getting the version of the ST, not the latest version from the STR - i.e.:
uint8[] memory _latestVersion = ISecurityToken(msg.sender).getVersion();

set(Encoder.getKey('registry', _moduleFactory), uint256(moduleType));
set(Encoder.getKey('moduleListIndex', _moduleFactory), uint256(getArrayAddress(Encoder.getKey('moduleList', uint256(moduleType))).length));
pushArray(Encoder.getKey('moduleList', uint256(moduleType)), _moduleFactory);
setArray(Encoder.getKey('reputation', _moduleFactory), new address[](0));
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you check that we're testing reputation in the test cases? Not sure that we need this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we are checking the reputation it is only used for the initialization of address[], not needed it will be performed automatically. So removed from here

moduleList[moduleType][index] = temp;
moduleListIndex[temp] = index;
// moduleList[moduleType][index] = temp;
addressArrayStorage[Encoder.getKey('moduleList', moduleType)][index] = temp;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use the getters here instead of direct access?

* @notice Called by moduleFactory owner or registry curator to delete a moduleFactory
* @param _moduleFactory is the address of the module factory to be deleted
* @notice Called by the ModuleFactory owner or registry curator to delete a ModuleFactory from the registry
* @param _moduleFactory is the address of the module factory to be deleted from the registry
* @return bool
*/
function removeModule(address _moduleFactory) external whenNotPaused returns(bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove the returns(bool) as we always return true (or throw)

}
}

/**
* @notice Called by moduleFactory owner to register new modules for SecurityToken to use
* @notice Called by the ModuleFactory owner to register new modules for SecurityTokens to use
* @param _moduleFactory is the address of the module factory to be registered
* @return bool
*/
function registerModule(address _moduleFactory) external whenNotPaused returns(bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Think we can remove returns(bool)

contracts/ModuleRegistry.sol Show resolved Hide resolved
@pabloruiz55 pabloruiz55 merged commit 141e3fa into development-1.5.0 Sep 27, 2018
@satyamakgec satyamakgec deleted the upgrade-mr branch October 30, 2019 12:12
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.

None yet

4 participants