Add function to configure the associated apps

This commit is contained in:
bumi 2020-12-01 12:22:31 +01:00
parent 9648499741
commit dc35344570
8 changed files with 35 additions and 2 deletions

View File

@ -14,6 +14,11 @@
"name": "Veto contributions", "name": "Veto contributions",
"id": "VETO_CONTRIBUTION_ROLE", "id": "VETO_CONTRIBUTION_ROLE",
"params": [] "params": []
},
{
"name": "Manage connected apps",
"id": "MANAGE_APPS_ROLE",
"params": []
} }
], ],
"environments": { "environments": {

View File

@ -17,6 +17,7 @@ interface ContributorInterface {
contract Contribution is AragonApp { contract Contribution is AragonApp {
bytes32 public constant ADD_CONTRIBUTION_ROLE = keccak256("ADD_CONTRIBUTION_ROLE"); bytes32 public constant ADD_CONTRIBUTION_ROLE = keccak256("ADD_CONTRIBUTION_ROLE");
bytes32 public constant VETO_CONTRIBUTION_ROLE = keccak256("VETO_CONTRIBUTION_ROLE"); bytes32 public constant VETO_CONTRIBUTION_ROLE = keccak256("VETO_CONTRIBUTION_ROLE");
bytes32 public constant MANAGE_APPS_ROLE = keccak256("MANAGE_APPS_ROLE");
IToken public kreditsToken; IToken public kreditsToken;
ContributorInterface public kreditsContributor; ContributorInterface public kreditsContributor;
@ -59,6 +60,11 @@ contract Contribution is AragonApp {
initialized(); initialized();
} }
function setApps(address _token, address _contributor) public isInitialized auth(MANAGE_APPS_ROLE) {
kreditsToken = IToken(_token);
kreditsContributor = ContributorInterface(_contributor);
}
// //
// Token standard functions (ERC 721) // Token standard functions (ERC 721)
// //

View File

@ -4,6 +4,11 @@
"name": "Manage contributors", "name": "Manage contributors",
"id": "MANAGE_CONTRIBUTORS_ROLE", "id": "MANAGE_CONTRIBUTORS_ROLE",
"params": [] "params": []
},
{
"name": "Manage connected apps",
"id": "MANAGE_APPS_ROLE",
"params": []
} }
], ],
"environments": { "environments": {

View File

@ -13,6 +13,7 @@ interface IContributionBalance {
contract Contributor is AragonApp { contract Contributor is AragonApp {
bytes32 public constant MANAGE_CONTRIBUTORS_ROLE = keccak256("MANAGE_CONTRIBUTORS_ROLE"); bytes32 public constant MANAGE_CONTRIBUTORS_ROLE = keccak256("MANAGE_CONTRIBUTORS_ROLE");
bytes32 public constant MANAGE_APPS_ROLE = keccak256("MANAGE_APPS_ROLE");
ITokenBalance public kreditsToken; ITokenBalance public kreditsToken;
IContributionBalance public kreditsContribution; IContributionBalance public kreditsContribution;
@ -39,6 +40,11 @@ contract Contributor is AragonApp {
initialized(); initialized();
} }
function setApps(address _contribution, address _token) public isInitialized auth(MANAGE_APPS_ROLE) {
kreditsToken = ITokenBalance(_token);
kreditsContribution = IContributionBalance(_contribution);
}
function coreContributorsCount() public view returns (uint32) { function coreContributorsCount() public view returns (uint32) {
uint32 count = 0; uint32 count = 0;
for (uint32 i = 1; i <= contributorsCount; i++) { for (uint32 i = 1; i <= contributorsCount; i++) {

View File

@ -9,6 +9,11 @@
"name": "Vote proposals", "name": "Vote proposals",
"id": "VOTE_PROPOSAL_ROLE", "id": "VOTE_PROPOSAL_ROLE",
"params": [] "params": []
},
{
"name": "Manage connected apps",
"id": "MANAGE_APPS_ROLE",
"params": []
} }
], ],
"environments": { "environments": {

View File

@ -17,6 +17,7 @@ contract Proposal is AragonApp {
bytes32 public constant ADD_PROPOSAL_ROLE = keccak256("ADD_PROPOSAL_ROLE"); bytes32 public constant ADD_PROPOSAL_ROLE = keccak256("ADD_PROPOSAL_ROLE");
bytes32 public constant VOTE_PROPOSAL_ROLE = keccak256("VOTE_PROPOSAL_ROLE"); bytes32 public constant VOTE_PROPOSAL_ROLE = keccak256("VOTE_PROPOSAL_ROLE");
bytes32 public constant MANAGE_APPS_ROLE = keccak256("MANAGE_APPS_ROLE");
IContributor public kreditsContributor; IContributor public kreditsContributor;
IContribution public kreditsContribution; IContribution public kreditsContribution;
@ -50,6 +51,11 @@ contract Proposal is AragonApp {
initialized(); initialized();
} }
function setApps(address _contributor, address _contribution) public isInitialized auth(MANAGE_APPS_ROLE) {
kreditsContributor = IContributor(_contributor);
kreditsContribution = IContribution(_contribution);
}
function addProposal(uint32 contributorId, uint32 amount, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_PROPOSAL_ROLE) { function addProposal(uint32 contributorId, uint32 amount, bytes32 hashDigest, uint8 hashFunction, uint8 hashSize) public isInitialized auth(ADD_PROPOSAL_ROLE) {
require(kreditsContributor.exists(contributorId), 'CONTRIBUTOR_NOT_FOUND'); require(kreditsContributor.exists(contributorId), 'CONTRIBUTOR_NOT_FOUND');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long