-
Notifications
You must be signed in to change notification settings - Fork 152
Percentage tm admin permission #379
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1197ab6
Make `changeHolderPercentage` in PercentageTM a permissioned
dea6189
Add delegate l_percentage_transfer_manager.js
6e692d3
Merge branch 'development-1.5.0' into PercentageTM-admin-permission
90f1619
Merge branch 'development-1.5.0' into PercentageTM-admin-permission
maxsam4 9536d8a
Remove redundant getters: fixed review comments
7811f58
Merge branch 'PercentageTM-admin-permission' of https://github.com/Po…
d123f37
Update test/l_percentage_transfer_manager.js
maxsam4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ contract("PercentageTransferManager", accounts => { | |
let account_investor2; | ||
let account_investor3; | ||
let account_investor4; | ||
let account_delegate; | ||
|
||
// investor Details | ||
let fromTime = latestTime(); | ||
|
@@ -57,6 +58,7 @@ contract("PercentageTransferManager", accounts => { | |
const tokenDetails = "This is equity type of issuance"; | ||
const decimals = 18; | ||
const contact = "[email protected]"; | ||
const delegateDetails = "Hello I am legit delegate"; | ||
|
||
// Module key | ||
const delegateManagerKey = 1; | ||
|
@@ -92,6 +94,7 @@ contract("PercentageTransferManager", accounts => { | |
account_investor1 = accounts[7]; | ||
account_investor2 = accounts[8]; | ||
account_investor3 = accounts[9]; | ||
account_delegate = accounts[6]; | ||
|
||
let instances = await setUpPolymathNetwork(account_polymath, token_owner); | ||
|
||
|
@@ -166,6 +169,18 @@ contract("PercentageTransferManager", accounts => { | |
let moduleData = (await I_SecurityToken.getModulesByType(2))[0]; | ||
I_GeneralTransferManager = GeneralTransferManager.at(moduleData); | ||
}); | ||
|
||
it("Should successfully attach the General permission manager factory with the security token", async () => { | ||
const tx = await I_SecurityToken.addModule(I_GeneralPermissionManagerFactory.address, "0x", 0, 0, { from: token_owner }); | ||
assert.equal(tx.logs[2].args._types[0].toNumber(), delegateManagerKey, "General Permission Manager doesn't get deployed"); | ||
assert.equal( | ||
web3.utils.toAscii(tx.logs[2].args._name).replace(/\u0000/g, ""), | ||
"GeneralPermissionManager", | ||
"GeneralPermissionManagerFactory module was not added" | ||
); | ||
I_GeneralPermissionManager = GeneralPermissionManager.at(tx.logs[2].args._module); | ||
}); | ||
|
||
}); | ||
|
||
describe("Buy tokens using on-chain whitelist", async () => { | ||
|
@@ -333,10 +348,32 @@ contract("PercentageTransferManager", accounts => { | |
) | ||
}); | ||
|
||
it("Should not be able to modify holder percentage to 100 - Unauthorized msg.sender", async () => { | ||
await catchRevert( | ||
I_PercentageTransferManager.changeHolderPercentage(100 * 10 ** 16, { from: account_delegate }) | ||
) | ||
}); | ||
|
||
it("Should successfully add the delegate", async() => { | ||
let tx = await I_GeneralPermissionManager.addDelegate(account_delegate, delegateDetails, { from: token_owner}); | ||
assert.equal(tx.logs[0].args._delegate, account_delegate); | ||
}); | ||
|
||
it("Should provide the permission", async() => { | ||
let tx = await I_GeneralPermissionManager.changePermission( | ||
account_delegate, | ||
I_PercentageTransferManager.address, | ||
"ADMIN", | ||
true, | ||
{from: token_owner} | ||
); | ||
assert.equal(tx.logs[0].args._delegate, account_delegate); | ||
}); | ||
|
||
it("Modify holder percentage to 100", async () => { | ||
// Add the Investor in to the whitelist | ||
// Mint some tokens | ||
await I_PercentageTransferManager.changeHolderPercentage(100 * 10 ** 16, { from: token_owner }); | ||
await I_PercentageTransferManager.changeHolderPercentage(100 * 10 ** 16, { from: account_delegate }); | ||
|
||
assert.equal((await I_PercentageTransferManager.maxHolderPercentage()).toNumber(), 100 * 10 ** 16); | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.