-
Notifications
You must be signed in to change notification settings - Fork 3
/
DAPP.sol
68 lines (56 loc) · 1.44 KB
/
DAPP.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
pragma solidity ^0.5.11;
import "../dao/DAO.sol";
contract DAPP {
// the DAO smart contract
DAO private _dao;
// the token fixed fee to use dapp
uint256 private _fee;
/**
* @dev fee tokens will be transferred into this.
* Transfer to a deposit wallet after useFee or add a withdraw tokens function.
*/
modifier useFee() {
_dao.use(msg.sender, _fee);
_;
}
/**
* @dev the amount of tokens will be transferred into this.
* Transfer to a deposit wallet after useTokens or add a withdraw tokens function.
* @param amount Number of tokens to use
*/
modifier useTokens(uint256 amount) {
_dao.use(msg.sender, amount);
_;
}
/**
* @dev modifier to allow only members to do some actions
*/
modifier onlyMember() {
require(_dao.isMember(msg.sender));
_;
}
/**
* @dev modifier to allow only approved to do some actions
*/
modifier onlyApproved() {
require(_dao.isApproved(msg.sender));
_;
}
constructor (DAO dao, uint256 fee) public {
require(address(dao) != address(0));
_dao = dao;
_fee = fee;
}
/**
* @return the DAO smart contract
*/
function dao() public view returns (DAO) {
return _dao;
}
/**
* @return the token fee to use dapp
*/
function fee() public view returns (uint256) {
return _fee;
}
}