|
1 | | -pragma solidity ^0.4.24; |
2 | | - |
3 | | -import "./ERC20DividendCheckpoint.sol"; |
4 | | -import "../ModuleFactory.sol"; |
5 | | - |
6 | | -/** |
7 | | - * @title Factory for deploying ERC20DividendCheckpoint module |
8 | | - */ |
9 | | -contract ERC20DividendCheckpointFactory is ModuleFactory { |
10 | | - |
11 | | - /** |
12 | | - * @notice Constructor |
13 | | - * @param _polyAddress Address of the polytoken |
14 | | - * @param _setupCost Setup cost of the module |
15 | | - * @param _usageCost Usage cost of the module |
16 | | - * @param _subscriptionCost Subscription cost of the module |
17 | | - */ |
18 | | - constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public |
19 | | - ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost) |
20 | | - { |
21 | | - version = "1.0.0"; |
22 | | - name = "ERC20DividendCheckpoint"; |
23 | | - title = "ERC20 Dividend Checkpoint"; |
24 | | - description = "Create ERC20 dividends for token holders at a specific checkpoint"; |
25 | | - compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); |
26 | | - compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); |
27 | | - } |
28 | | - |
29 | | - /** |
30 | | - * @notice used to launch the Module with the help of factory |
31 | | - * @return address Contract address of the Module |
32 | | - */ |
33 | | - function deploy(bytes /* _data */) external returns(address) { |
34 | | - if (setupCost > 0) |
35 | | - require(polyToken.transferFrom(msg.sender, owner, setupCost), "Failed transferFrom because of sufficent Allowance is not provided"); |
36 | | - address erc20DividendCheckpoint = new ERC20DividendCheckpoint(msg.sender, address(polyToken)); |
37 | | - emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); |
38 | | - return erc20DividendCheckpoint; |
39 | | - } |
40 | | - |
41 | | - /** |
42 | | - * @notice Type of the Module factory |
43 | | - */ |
44 | | - function getType() public view returns(uint8) { |
45 | | - return 4; |
46 | | - } |
47 | | - |
48 | | - /** |
49 | | - * @notice Get the name of the Module |
50 | | - */ |
51 | | - function getName() public view returns(bytes32) { |
52 | | - return name; |
53 | | - } |
54 | | - |
55 | | - /** |
56 | | - * @notice Get the description of the Module |
57 | | - */ |
58 | | - function getDescription() public view returns(string) { |
59 | | - return description; |
60 | | - } |
61 | | - |
62 | | - /** |
63 | | - * @notice Get the title of the Module |
64 | | - */ |
65 | | - function getTitle() public view returns(string) { |
66 | | - return title; |
67 | | - } |
68 | | - |
69 | | - /** |
70 | | - * @notice Get the version of the Module |
71 | | - */ |
72 | | - function getVersion() external view returns(string) { |
73 | | - return version; |
74 | | - } |
75 | | - |
76 | | - /** |
77 | | - * @notice Get the setup cost of the module |
78 | | - */ |
79 | | - function getSetupCost() external view returns (uint256) { |
80 | | - return setupCost; |
81 | | - } |
82 | | - |
83 | | - /** |
84 | | - * @notice Get the Instructions that helped to used the module |
85 | | - */ |
86 | | - function getInstructions() public view returns(string) { |
87 | | - return "Create a ERC20 dividend which will be paid out to token holders proportional to their balances at the point the dividend is created"; |
88 | | - } |
89 | | - |
90 | | - /** |
91 | | - * @notice Get the tags related to the module factory |
92 | | - */ |
93 | | - function getTags() public view returns(bytes32[]) { |
94 | | - bytes32[] memory availableTags = new bytes32[](3); |
95 | | - availableTags[0] = "ERC20"; |
96 | | - availableTags[1] = "Dividend"; |
97 | | - availableTags[2] = "Checkpoint"; |
98 | | - return availableTags; |
99 | | - } |
100 | | -} |
| 1 | +pragma solidity ^0.4.24; |
| 2 | + |
| 3 | +import "./ERC20DividendCheckpoint.sol"; |
| 4 | +import "../ModuleFactory.sol"; |
| 5 | + |
| 6 | +/** |
| 7 | + * @title Factory for deploying ERC20DividendCheckpoint module |
| 8 | + */ |
| 9 | +contract ERC20DividendCheckpointFactory is ModuleFactory { |
| 10 | + |
| 11 | + /** |
| 12 | + * @notice Constructor |
| 13 | + * @param _polyAddress Address of the polytoken |
| 14 | + * @param _setupCost Setup cost of the module |
| 15 | + * @param _usageCost Usage cost of the module |
| 16 | + * @param _subscriptionCost Subscription cost of the module |
| 17 | + */ |
| 18 | + constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost) public |
| 19 | + ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost) |
| 20 | + { |
| 21 | + version = "1.0.0"; |
| 22 | + name = "ERC20DividendCheckpoint"; |
| 23 | + title = "ERC20 Dividend Checkpoint"; |
| 24 | + description = "Create ERC20 dividends for token holders at a specific checkpoint"; |
| 25 | + compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); |
| 26 | + compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0)); |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * @notice used to launch the Module with the help of factory |
| 31 | + * @return address Contract address of the Module |
| 32 | + */ |
| 33 | + function deploy(bytes /* _data */) external returns(address) { |
| 34 | + if (setupCost > 0) |
| 35 | + require(polyToken.transferFrom(msg.sender, owner, setupCost), "Failed transferFrom because of sufficent Allowance is not provided"); |
| 36 | + address erc20DividendCheckpoint = new ERC20DividendCheckpoint(msg.sender, address(polyToken)); |
| 37 | + emit GenerateModuleFromFactory(erc20DividendCheckpoint, getName(), address(this), msg.sender, setupCost, now); |
| 38 | + return erc20DividendCheckpoint; |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * @notice Type of the Module factory |
| 43 | + */ |
| 44 | + function getType() public view returns(uint8) { |
| 45 | + return 4; |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * @notice Get the name of the Module |
| 50 | + */ |
| 51 | + function getName() public view returns(bytes32) { |
| 52 | + return name; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @notice Get the description of the Module |
| 57 | + */ |
| 58 | + function getDescription() public view returns(string) { |
| 59 | + return description; |
| 60 | + } |
| 61 | + |
| 62 | + /** |
| 63 | + * @notice Get the title of the Module |
| 64 | + */ |
| 65 | + function getTitle() public view returns(string) { |
| 66 | + return title; |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @notice Get the version of the Module |
| 71 | + */ |
| 72 | + function getVersion() external view returns(string) { |
| 73 | + return version; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @notice Get the setup cost of the module |
| 78 | + */ |
| 79 | + function getSetupCost() external view returns (uint256) { |
| 80 | + return setupCost; |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * @notice Get the Instructions that helped to used the module |
| 85 | + */ |
| 86 | + function getInstructions() public view returns(string) { |
| 87 | + return "Create a ERC20 dividend which will be paid out to token holders proportional to their balances at the point the dividend is created"; |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * @notice Get the tags related to the module factory |
| 92 | + */ |
| 93 | + function getTags() public view returns(bytes32[]) { |
| 94 | + bytes32[] memory availableTags = new bytes32[](3); |
| 95 | + availableTags[0] = "ERC20"; |
| 96 | + availableTags[1] = "Dividend"; |
| 97 | + availableTags[2] = "Checkpoint"; |
| 98 | + return availableTags; |
| 99 | + } |
| 100 | +} |
0 commit comments