-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathScheduledCheckpointFactory.sol
More file actions
103 lines (91 loc) · 3.12 KB
/
ScheduledCheckpointFactory.sol
File metadata and controls
103 lines (91 loc) · 3.12 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
pragma solidity ^0.4.24;
import "./ScheduledCheckpoint.sol";
import "../../ModuleFactory.sol";
/**
* @title Factory for deploying EtherDividendCheckpoint module
*/
contract ScheduledCheckpointFactory is ModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _subscriptionCost Subscription cost of the module
*/
constructor (uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public
ModuleFactory(_setupCost, _usageCost, _subscriptionCost)
{
version = "1.0.0";
name = "ScheduledCheckpoint";
title = "Schedule Checkpoints";
description = "Allows you to schedule checkpoints in the future";
compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0));
compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0));
}
/**
* @notice used to launch the Module with the help of factory
* @return address Contract address of the Module
*/
function deploy(bytes /* _data */) external returns(address) {
updateFromRegistry(msg.sender);
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner(), setupCost), "Failed transferFrom because of sufficent Allowance is not provided");
}
address scheduledCheckpoint = new ScheduledCheckpoint(msg.sender);
emit GenerateModuleFromFactory(scheduledCheckpoint, getName(), address(this), msg.sender, setupCost, now);
return scheduledCheckpoint;
}
/**
* @notice Type of the Module factory
*/
function getTypes() external view returns(uint8[]) {
uint8[] memory res = new uint8[](2);
res[0] = 4;
res[1] = 2;
return res;
}
/**
* @notice Get the name of the Module
*/
function getName() public view returns(bytes32) {
return name;
}
/**
* @notice Get the description of the Module
*/
function getDescription() external view returns(string) {
return description;
}
/**
* @notice Get the title of the Module
*/
function getTitle() external view returns(string) {
return title;
}
/**
* @notice Get the version of the Module
*/
function getVersion() external view returns(string) {
return version;
}
/**
* @notice Get the setup cost of the module
*/
function getSetupCost() external view returns (uint256) {
return setupCost;
}
/**
* @notice Get the Instructions that helped to used the module
*/
function getInstructions() external view returns(string) {
return "Schedule a series of future checkpoints by specifying a start time and interval of each checkpoint";
}
/**
* @notice Get the tags related to the module factory
*/
function getTags() external view returns(bytes32[]) {
bytes32[] memory availableTags = new bytes32[](2);
availableTags[0] = "Scheduled";
availableTags[1] = "Checkpoint";
return availableTags;
}
}