-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify role assignment for accounts
- Loading branch information
Showing
11 changed files
with
30 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,49 +1,26 @@ | ||
const { accounts } = require('hardhat'); | ||
const { accounts, ethers } = require('hardhat'); | ||
|
||
const [defaultSender] = accounts; | ||
const nonMembers = accounts.slice(1, 5); | ||
const members = accounts.slice(5, 10); | ||
const advisoryBoardMembers = accounts.slice(10, 15); | ||
const internalContracts = accounts.slice(15, 20); | ||
const nonInternalContracts = accounts.slice(20, 25); | ||
const governanceContracts = accounts.slice(25, 30); | ||
const stakingPoolManagers = accounts.slice(30, 35); | ||
const generalPurpose = accounts.slice(35); // 65 general purpose addresses | ||
const assingRoles = accounts => ({ | ||
defaultSender: accounts[0], | ||
nonMembers: accounts.slice(1, 5), | ||
members: accounts.slice(5, 10), | ||
advisoryBoardMembers: accounts.slice(10, 15), | ||
internalContracts: accounts.slice(15, 20), | ||
nonInternalContracts: accounts.slice(20, 25), | ||
governanceContracts: accounts.slice(25, 30), | ||
stakingPoolManagers: accounts.slice(30, 35), | ||
emergencyAdmin: accounts[35], | ||
generalPurpose: accounts.slice(36), | ||
}); | ||
|
||
const getAccounts = accounts => { | ||
const [defaultSender] = accounts; | ||
const nonMembers = accounts.slice(1, 5); | ||
const members = accounts.slice(5, 10); | ||
const advisoryBoardMembers = accounts.slice(10, 15); | ||
const internalContracts = accounts.slice(15, 20); | ||
const nonInternalContracts = accounts.slice(20, 25); | ||
const governanceContracts = accounts.slice(25, 30); | ||
const stakingPoolManagers = accounts.slice(30, 35); | ||
const emergencyAdmin = accounts[35]; | ||
const generalPurpose = accounts.slice(36); // 65 general purpose addresses | ||
return { | ||
defaultSender, | ||
nonMembers, | ||
members, | ||
advisoryBoardMembers, | ||
internalContracts, | ||
nonInternalContracts, | ||
governanceContracts, | ||
stakingPoolManagers, | ||
generalPurpose, | ||
emergencyAdmin, | ||
}; | ||
const getAccounts = async () => { | ||
const accounts = await ethers.getSigners(); | ||
return assingRoles(accounts); | ||
}; | ||
|
||
const accountRoles = assingRoles(accounts); | ||
|
||
module.exports = { | ||
getAccounts, | ||
defaultSender, | ||
nonMembers, | ||
members, | ||
advisoryBoardMembers, | ||
internalContracts, | ||
nonInternalContracts, | ||
governanceContracts, | ||
stakingPoolManagers, | ||
generalPurpose, | ||
...accountRoles, | ||
}; |