Skip to content

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?

* @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)

* @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)

@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.

5 participants