add test · dev-protocol/protocol@f893b0c · GitHub
Skip to content

Commit f893b0c

Browse files
add test
1 parent 8997d7e commit f893b0c

13 files changed

Lines changed: 230 additions & 58 deletions

File tree

Lines changed: 41 additions & 41 deletions

‎.github/ISSUE_TEMPLATE/feature_request.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Feature request
22
description: Suggest features, propose improvements, discuss new ideas
3-
title: "[FEATURE] <description>"
3+
title: '[FEATURE] <description>'
44
labels: [enhancement]
55
body:
66
- type: markdown

‎.github/ISSUE_TEMPLATE/other.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Other
22
description: Use this for any other issues. PLEASE do not create blank issues
3-
title: "[OTHER]"
3+
title: '[OTHER]'
44
labels: [triage]
55
body:
66
- type: markdown
77
attributes:
8-
value: "# Other issue"
8+
value: '# Other issue'
99
- type: textarea
1010
id: issuedescription
1111
attributes:

‎.github/ISSUE_TEMPLATE/question.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Question
22
description: Ask the team a question about this project
3-
title: "[QUESTION] <description>"
3+
title: '[QUESTION] <description>'
44
labels: [question]
55
body:
66
- type: input

‎contracts/interface/IMarket.sol‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ interface IMarket {
3838
function votingEndBlockNumber() external view returns (uint256);
3939

4040
function toEnable() external;
41+
42+
function toDisable() external;
4143
}

‎contracts/interface/IMarketFactory.sol‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ interface IMarketFactory {
55
function create(address _addr) external returns (address);
66

77
function enable(address _addr) external;
8+
9+
function disable(address _addr) external;
810
}

‎contracts/interface/IMarketGroup.sol‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ pragma solidity >=0.5.17;
44
interface IMarketGroup {
55
function addGroup(address _addr) external;
66

7+
function deleteGroup(address _addr) external;
8+
79
function isGroup(address _addr) external view returns (bool);
810

911
function getCount() external view returns (uint256);

‎contracts/src/market/Market.sol‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,20 @@ contract Market is UsingConfig, IMarket {
9292
* Called from MarketFactory contract.
9393
*/
9494
function toEnable() external {
95-
require(
96-
msg.sender == config().marketFactory(),
97-
"this is illegal address"
98-
);
95+
require(msg.sender == config().marketFactory(), "illegal accesss");
9996
require(isDuringVotingPeriod(), "deadline is over");
10097
enabled = true;
10198
}
10299

100+
/**
101+
* deactivates this Market.
102+
* Called from MarketFactory contract.
103+
*/
104+
function toDisable() external {
105+
require(msg.sender == config().marketFactory(), "illegal accesss");
106+
enabled = false;
107+
}
108+
103109
/**
104110
* Authenticates the new asset and proves that the Property author is the owner of the asset.
105111
*/

‎contracts/src/market/MarketFactory.sol‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract MarketFactory is Ownable, IMarketFactory, UsingConfig {
5959
* Validates the passed address is not 0 address.
6060
*/
6161
IMarketGroup marketGroup = IMarketGroup(config().marketGroup());
62-
require(marketGroup.isGroup(_addr), "this is illegal address");
62+
require(marketGroup.isGroup(_addr), "illegal address");
6363

6464
/**
6565
* Market will be enable.
@@ -69,4 +69,24 @@ contract MarketFactory is Ownable, IMarketFactory, UsingConfig {
6969

7070
market.toEnable();
7171
}
72+
73+
/**
74+
* Creates a new Market contract.
75+
*/
76+
function disable(address _addr) external onlyOwner {
77+
/**
78+
* Validates the passed address is not 0 address.
79+
*/
80+
IMarketGroup marketGroup = IMarketGroup(config().marketGroup());
81+
require(marketGroup.isGroup(_addr), "illegal address");
82+
83+
/**
84+
* Market will be enable.
85+
*/
86+
IMarket market = IMarket(_addr);
87+
require(market.enabled() == true, "already disabled");
88+
89+
market.toDisable();
90+
marketGroup.deleteGroup(_addr);
91+
}
7292
}

‎contracts/src/market/MarketGroup.sol‎

Lines changed: 19 additions & 4 deletions

0 commit comments

Comments
 (0)