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

Add treasury wallet in global storage #555

Merged
merged 22 commits into from
Mar 6, 2019
Merged

Conversation

satyamakgec
Copy link
Contributor

No description provided.

@coveralls
Copy link

coveralls commented Feb 15, 2019

Coverage Status

Coverage increased (+4.02%) to 100.0% when pulling 8d788f6 on move-treasury-wallet into a2e8b17 on dev-3.0.0.

@satyamakgec satyamakgec changed the title WIP: add treasury wallet in global storage Add treasury wallet in global storage Feb 15, 2019
contracts/modules/ModuleStorage.sol Outdated Show resolved Hide resolved
contracts/SecurityTokenRegistry.sol Outdated Show resolved Hide resolved
contracts/datastore/DataStore.sol Outdated Show resolved Hide resolved
contracts/modules/Checkpoint/DividendCheckpoint.sol Outdated Show resolved Hide resolved
contracts/modules/Checkpoint/ERC20DividendCheckpoint.sol Outdated Show resolved Hide resolved
contracts/modules/Checkpoint/EtherDividendCheckpoint.sol Outdated Show resolved Hide resolved
contracts/modules/STO/USDTieredSTO.sol Outdated Show resolved Hide resolved
contracts/tokens/STFactory.sol Show resolved Hide resolved
Copy link
Contributor

@maxsam4 maxsam4 left a comment

Choose a reason for hiding this comment

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

Can you please also update the changelog.
Rest of the PR looks good to me.

contracts/interfaces/ISecurityTokenRegistry.sol Outdated Show resolved Hide resolved
@adamdossa
Copy link
Contributor

@satyamakgec As per discussion this morning, please can you add treasury wallet to module config files (where it existed previously) but with the logic that address(0) is valid (and corresponds to using the DS version).

@@ -257,7 +257,7 @@ contract ERC20DividendCheckpoint is ERC20DividendCheckpointStorage, DividendChec
dividends[_dividendIndex].reclaimed = true;
Dividend storage dividend = dividends[_dividendIndex];
uint256 remainingAmount = dividend.amount.sub(dividend.claimedAmount);
require(IERC20(dividendTokens[_dividendIndex]).transfer(wallet, remainingAmount), "transfer failed");
require(IERC20(dividendTokens[_dividendIndex]).transfer(getTreasuryWallet(), remainingAmount), "transfer failed");
Copy link
Contributor

Choose a reason for hiding this comment

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

For good measure do you think we should be checking that getTreasuryWallet() doesn't return address(0)? I agree that with the current code it can't, but in some future model if there was a bug, perhaps the datastore treasury wallet could be over-written with 0, and we wouldn't want to send funds there under any circumstances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on this measure, global treasury wallet is only be changed using the changeTreasuryWallet() function that is present in the SecurityToken and we have the 0 address check init. So it doesn't require any further check. And yes there is no harm to add one more check.

contracts/modules/STO/USDTiered/USDTieredSTO.sol Outdated Show resolved Hide resolved
contracts/modules/STO/USDTiered/USDTieredSTO.sol Outdated Show resolved Hide resolved
@@ -45,6 +46,7 @@ contract STFactory is ISTFactory {
);
//NB When dataStore is generated, the security token address is automatically set via the constructor in DataStoreProxy.
newSecurityToken.changeDataStore(dataStoreFactory.generateDataStore(address(newSecurityToken)));
newSecurityToken.changeTreasuryWallet(_treasuryWallet);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason to not add this to the token constructor directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because datastore doesn't aware of the security token address at that time.

@adamdossa adamdossa merged commit 84f01b0 into dev-3.0.0 Mar 6, 2019
@satyamakgec satyamakgec deleted the move-treasury-wallet branch October 30, 2019 12:22
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

6 participants