Membership
This commit is contained in:
27
contracts/MemberSystem/impl/MemPermission.sol
Normal file
27
contracts/MemberSystem/impl/MemPermission.sol
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {Ownable} from "../../lib/Ownable.sol";
|
||||
import {IPermissionManager} from "../../lib/PermissionManager.sol";
|
||||
import {IMemSource} from "./MemSourceStake.sol";
|
||||
|
||||
contract MemPermission is Ownable {
|
||||
uint256 public _MEM_LEVEL_THRESHOLD_;
|
||||
address public _MEM_LEVEL_SOURCE_;
|
||||
|
||||
constructor(address memLevelSource, uint256 memLevelThreshold) public {
|
||||
_MEM_LEVEL_THRESHOLD_ = memLevelThreshold;
|
||||
_MEM_LEVEL_SOURCE_ = memLevelSource;
|
||||
}
|
||||
|
||||
function isAllowed(address account) external returns (bool) {
|
||||
return IMemSource(_MEM_LEVEL_SOURCE_).getMemLevel(account) >= _MEM_LEVEL_THRESHOLD_;
|
||||
}
|
||||
}
|
||||
27
contracts/MemberSystem/impl/MemSourceHold.sol
Normal file
27
contracts/MemberSystem/impl/MemSourceHold.sol
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.6.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import {Ownable} from "../../lib/Ownable.sol";
|
||||
import {IMemSource} from "./MemAggregator.sol";
|
||||
import {IERC20} from "../../intf/IERC20.sol";
|
||||
|
||||
contract MemSourceHold is Ownable, IMemSource {
|
||||
address public _DODO_TOKEN_;
|
||||
|
||||
constructor(address dodoToken) public {
|
||||
_DODO_TOKEN_ = dodoToken;
|
||||
}
|
||||
|
||||
// ============ View Function ============
|
||||
|
||||
function getMemLevel(address user) external override returns (uint256) {
|
||||
return IERC20(_DODO_TOKEN_).balanceOf(user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user