-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added fund agent role instead of single token operator
- Loading branch information
1 parent
21d3341
commit 93fb184
Showing
11 changed files
with
2,032 additions
and
159 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
pragma solidity ^0.5.0; | ||
|
||
import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; | ||
import "openzeppelin-solidity/contracts/access/Roles.sol"; | ||
|
||
|
||
contract FundAgentRole is Ownable { | ||
using Roles for Roles.Role; | ||
|
||
Roles.Role internal fundAgents; | ||
|
||
modifier onlyFundAgent() { | ||
_onlyFundAgent(); | ||
_; | ||
} | ||
|
||
function addFundAgent(address _who) public onlyOwner { | ||
fundAgents.add(_who); | ||
} | ||
|
||
function removeFundAgent(address _who) public onlyOwner { | ||
fundAgents.remove(_who); | ||
} | ||
|
||
function isFundAgent(address _who) public view returns (bool) { | ||
return fundAgents.has(_who); | ||
} | ||
|
||
function _onlyFundAgent() private view { | ||
require(isFundAgent(msg.sender), "FundAgentRole: caller is not a fund agent"); | ||
} | ||
} |
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,7 +1,6 @@ | ||
@startuml | ||
UserA -> "Fundable Token": orderFund | ||
"Fundable Token" --> "Token Contract Operator": FundOrdered | ||
|
||
"Fundable Token" --> "Fund Agent": FundOrdered | ||
UserA -> "Fundable Token": cancelFund | ||
"Fundable Token" --> "Token Contract Operator": FundCancelled | ||
@enduml | ||
"Fundable Token" --> "Fund Agent": FundCancelled | ||
@enduml |
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,9 +1,9 @@ | ||
@startuml | ||
UserA -> "Fundable Token": orderFund | ||
"Fundable Token" --> "Token Contract Operator": FundOrdered | ||
"Token Contract Operator" -> "Fundable Token": processFund | ||
"Fundable Token" --> "Fund Agent": FundOrdered | ||
"Fund Agent" -> "Fundable Token": processFund | ||
"Fundable Token" --> "UserA": FundInProcess | ||
"userA funds" --> "Token Contract Operator": transfer funds | ||
"Token Contract Operator" -> "Fundable Token": executeFund | ||
"UserA funds" --> "Fund Agent": transfer funds | ||
"Fund Agent" -> "Fundable Token": executeFund | ||
"Fundable Token" --> UserA: FundExecuted | ||
@enduml | ||
@enduml |
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,7 +1,6 @@ | ||
@startuml | ||
UserA -> "Fundable Token": orderFund | ||
"Fundable Token" --> "Token Contract Operator": FundOrdered | ||
|
||
"Token Contract Operator" -> "Fundable Token": rejectFund | ||
"Fundable Token" --> "Fund Agent": FundOrdered | ||
"Fund Agent" -> "Fundable Token": rejectFund | ||
"Fundable Token" --> "UserA": FundRejected | ||
@enduml | ||
@enduml |
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,13 +1,13 @@ | ||
@startuml | ||
[*] --> Ordered: FundOrdered | ||
Ordered --> InProcess: FundInProcess | ||
Ordered: Tokens are pending to be processed by the token contract operator | ||
Ordered: Tokens are pending to be processed by a fund agent | ||
InProcess: The fund operation was started, but the tokens are not yet in the balance of the user | ||
InProcess --> Executed: FundExecuted | ||
Executed: The tokens are minted for the user | ||
Ordered --> Cancelled: FundCancelled | ||
Cancelled: Can only be called by the user | ||
Ordered --> Rejected: FundRejected | ||
InProcess --> Rejected: FundRejected | ||
Rejected: Can only be called by the token contract operator | ||
@enduml | ||
Rejected: Can only be called by a fund agent | ||
@enduml |
Oops, something went wrong.