Skip to content

Commit

Permalink
[3.31] Removed take usage fee (#700)
Browse files Browse the repository at this point in the history
* Removed takeUsageFee

* Test fix

* tests fixed
  • Loading branch information
maxsam4 authored Jun 12, 2019
1 parent 12ed7b3 commit cbf785d
Show file tree
Hide file tree
Showing 37 changed files with 107 additions and 250 deletions.
5 changes: 0 additions & 5 deletions contracts/interfaces/IModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ interface IModule {
*/
function getPermissions() external view returns(bytes32[] memory);

/**
* @notice Used to withdraw the fee by the factory owner
*/
function takeUsageFee() external returns(bool);

}
24 changes: 3 additions & 21 deletions contracts/interfaces/IModuleFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pragma solidity ^0.5.0;
interface IModuleFactory {
event ChangeSetupCost(uint256 _oldSetupCost, uint256 _newSetupCost);
event ChangeCostType(bool _isOldCostInPoly, bool _isNewCostInPoly);
event ChangeUsageCost(uint256 _oldUsageCost, uint256 _newUsageCost);
event GenerateModuleFromFactory(
address _module,
bytes32 indexed _moduleName,
Expand Down Expand Up @@ -40,11 +39,6 @@ interface IModuleFactory {
*/
function description() external view returns(string memory);

/**
* @notice Get the setup cost of the module in USD
*/
function usageCost() external returns(uint256);

/**
* @notice Get the setup cost of the module in USD
*/
Expand All @@ -67,18 +61,11 @@ interface IModuleFactory {
function changeSetupCost(uint256 _newSetupCost) external;

/**
* @notice Used to change the usage fee
* @param _newUsageCost New usage fee
*/
function changeUsageCost(uint256 _newUsageCost) external;

/**
* @notice Used to change the currency and amount of usage and setup cost
* @notice Used to change the currency and amount setup cost
* @param _setupCost new setup cost
* @param _usageCost new usage cost
* @param _isCostInPoly new usage cost currency. USD or POLY
* @param _isCostInPoly new setup cost currency. USD or POLY
*/
function changeCostsAndType(uint256 _setupCost, uint256 _usageCost, bool _isCostInPoly) external;
function changeCostAndType(uint256 _setupCost, bool _isCostInPoly) external;

/**
* @notice Function use to change the lower and upper bound of the compatible version st
Expand All @@ -87,11 +74,6 @@ interface IModuleFactory {
*/
function changeSTVersionBounds(string calldata _boundType, uint8[] calldata _newVersion) external;

/**
* @notice Get the setup cost of the module in USD
*/
function usageCostInPoly() external returns(uint256);

/**
* @notice Get the setup cost of the module
*/
Expand Down
6 changes: 2 additions & 4 deletions contracts/mocks/Dummy/DummySTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ contract DummySTOFactory is UpgradableModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor (
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isCostInPoly
)
public
UpgradableModuleFactory("3.0.0", _setupCost, _usageCost, _logicContract, _polymathRegistry, _isCostInPoly)
UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly)
{
name = "DummySTO";
title = "Dummy STO";
Expand Down
4 changes: 1 addition & 3 deletions contracts/mocks/MockBurnFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ contract MockBurnFactory is TrackedRedemptionFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _polymathRegistry Address of the Polymath Registry
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isFeeInPoly
)
public
TrackedRedemptionFactory(_setupCost, _usageCost, _polymathRegistry, _isFeeInPoly)
TrackedRedemptionFactory(_setupCost, _polymathRegistry, _isFeeInPoly)
{

}
Expand Down
6 changes: 2 additions & 4 deletions contracts/mocks/MockFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ contract MockFactory is DummySTOFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath Registry
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isFeeInPoly
)
public
DummySTOFactory(_setupCost, _usageCost, _logicContract, _polymathRegistry, _isFeeInPoly)
DummySTOFactory(_setupCost, _logicContract, _polymathRegistry, _isFeeInPoly)
{
}

Expand Down
4 changes: 1 addition & 3 deletions contracts/mocks/MockWrongTypeFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ contract MockWrongTypeFactory is MockBurnFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _polymathRegistry Address of the Polymath Registry
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isFeeInPoly
)
public
MockBurnFactory(_setupCost, _usageCost, _polymathRegistry, _isFeeInPoly)
MockBurnFactory(_setupCost, _polymathRegistry, _isFeeInPoly)
{

}
Expand Down
6 changes: 2 additions & 4 deletions contracts/mocks/TestSTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ contract TestSTOFactory is DummySTOFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath Registry
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isFeeInPoly
)
public
DummySTOFactory(_setupCost, _usageCost, _logicContract, _polymathRegistry, _isFeeInPoly)
DummySTOFactory(_setupCost, _logicContract, _polymathRegistry, _isFeeInPoly)
{
name = "TestSTO";
title = "Test STO";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ contract ERC20DividendCheckpointFactory is UpgradableModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor (
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isCostInPoly
)
public
UpgradableModuleFactory("3.0.0", _setupCost, _usageCost, _logicContract, _polymathRegistry, _isCostInPoly)
UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly)
{
name = "ERC20DividendCheckpoint";
title = "ERC20 Dividend Checkpoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ contract EtherDividendCheckpointFactory is UpgradableModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor (
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isCostInPoly
)
public
UpgradableModuleFactory("3.0.0", _setupCost, _usageCost, _logicContract, _polymathRegistry, _isCostInPoly)
UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly)
{
name = "EtherDividendCheckpoint";
title = "Ether Dividend Checkpoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ contract PLCRVotingCheckpointFactory is UpgradableModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor (
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isCostInPoly
)
public
UpgradableModuleFactory("3.0.0", _setupCost, _usageCost, _logicContract, _polymathRegistry, _isCostInPoly)
UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "PLCRVotingCheckpoint";
Expand All @@ -48,4 +46,4 @@ contract PLCRVotingCheckpointFactory is UpgradableModuleFactory {
_initializeModule(plcrVotingCheckpoint, _data);
return plcrVotingCheckpoint;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ contract WeightedVoteCheckpointFactory is UpgradableModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _logicContract Contract address that contains the logic related to `description`
* @param _logicContract Contract address that contains the logic related to `description`
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor (
uint256 _setupCost,
uint256 _usageCost,
address _logicContract,
address _polymathRegistry,
bool _isCostInPoly
)
public
UpgradableModuleFactory("3.0.0", _setupCost, _usageCost, _logicContract, _polymathRegistry, _isCostInPoly)
UpgradableModuleFactory("3.0.0", _setupCost, _logicContract, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "WeightedVoteCheckpoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ contract TrackedRedemptionFactory is ModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of module
* @param _usageCost Usage cost of module
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isCostInPoly
)
public ModuleFactory(_setupCost, _usageCost, _polymathRegistry, _isCostInPoly)
public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "TrackedRedemption";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ contract ScheduledCheckpointFactory is ModuleFactory {
/**
* @notice Constructor
* @param _setupCost Setup cost of the module
* @param _usageCost Usage cost of the module
* @param _polymathRegistry Address of the Polymath registry
* @param _polymathRegistry Address of the Polymath registry
* @param _isCostInPoly true = cost in Poly, false = USD
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isCostInPoly
)
public ModuleFactory(_setupCost, _usageCost, _polymathRegistry, _isCostInPoly)
public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "ScheduledCheckpoint";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ contract KYCTransferManagerFactory is ModuleFactory {
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isCostInPoly
)
public ModuleFactory(_setupCost, _usageCost, _polymathRegistry, _isCostInPoly)
public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "KYCTransferManager";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ contract SignedTransferManagerFactory is ModuleFactory {
*/
constructor(
uint256 _setupCost,
uint256 _usageCost,
address _polymathRegistry,
bool _isCostInPoly
)
public ModuleFactory(_setupCost, _usageCost, _polymathRegistry, _isCostInPoly)
public ModuleFactory(_setupCost, _polymathRegistry, _isCostInPoly)
{
initialVersion = "3.0.0";
name = "SignedTransferManager";
Expand Down
10 changes: 1 addition & 9 deletions contracts/modules/Module.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ contract Module is IModule, ModuleStorage, Pausable {
super._unpause();
}

/**
* @notice used to withdraw the fee by the factory owner
*/
function takeUsageFee() public withPerm(ADMIN) returns(bool) {
require(polyToken.transferFrom(securityToken, Ownable(factory).owner(), IModuleFactory(factory).usageCostInPoly()), "Unable to take fee");
return true;
}

/**
* @notice used to return the data store address of securityToken
*/
Expand Down Expand Up @@ -96,5 +88,5 @@ contract Module is IModule, ModuleStorage, Pausable {
function reclaimETH() external {
_onlySecurityTokenOwner();
msg.sender.transfer(address(this).balance);
}
}
}
Loading

0 comments on commit cbf785d

Please sign in to comment.