Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vesting escrow wallet #422

Merged
merged 118 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
28f784b
added VestingEscrowWallet
Nov 12, 2018
de2f1eb
added z_vesting_escrow_wallet.js
Nov 13, 2018
ee2c89d
refactored add and revoke methods
Nov 13, 2018
1fadb74
added nextDate to schedule
Nov 14, 2018
d7896dd
added _update, State, lockedTokens
Nov 14, 2018
2b71785
added deposit/withdrawal functions
Nov 14, 2018
1e6e7ca
added batch operations, events
Nov 14, 2018
fa7c049
added template
Nov 14, 2018
a13bdac
renamed startDate, nextDate to startTime, nextTime
Nov 15, 2018
ae3c85b
added edit and batchEdit
Nov 15, 2018
21377cd
removed redundant "vesting" from names
Nov 15, 2018
d600f97
updated test addVestingSchedule
Nov 15, 2018
bafb540
tests for adding and revoking schedules
Nov 15, 2018
ecc03aa
tests for templates
Nov 15, 2018
59c4226
tests for depositing and withdrawing tokens
Nov 16, 2018
fb9b15e
fixed depositing/withdrawing tests
Nov 16, 2018
e3b9bb3
docs for public, external functions
Nov 19, 2018
af8297b
check withdraw with 3 schedules
Nov 19, 2018
e9b0566
Tests for batch operations
Nov 19, 2018
3b6fd89
tests for negative cases
Nov 19, 2018
99750f6
disabled tests: depositing and withdrawing tokens
Nov 19, 2018
313c7d0
fixed "Error: Exceeds block gas limit"
Nov 20, 2018
bfa6a5c
updated VestingEscrowWallet to use it as a module
Nov 20, 2018
0e357eb
updated tests for VestingEscrowWallet
Nov 20, 2018
99eeaf3
changed error messages
Nov 20, 2018
a6c7b55
Initialization of VestingEscrowWallet module in tests
Nov 20, 2018
d28da6f
fixed tests
Nov 21, 2018
a361ffe
use delegate instead of owner in tests
Nov 21, 2018
45fddfe
optimized VestingEscrowWallet
Nov 21, 2018
b26f12a
added tests for checking permission
Nov 21, 2018
92fb53a
added test for factory, applied review comments
Nov 21, 2018
3de498b
review comments: renaming, redundant operations
Nov 22, 2018
6f10ec0
review comments: use ST instead of configuring by tokens
Nov 22, 2018
c26a8ca
review comments: simplified data structure
Nov 22, 2018
03437b8
review comments: removed redundant functions
Nov 23, 2018
4add551
removed dataMap
Nov 23, 2018
42e6817
refactored revoke methods
Nov 23, 2018
210fbb9
test for pushing during revoking, getState method
Nov 23, 2018
baf0ec9
fixed coverage failure
Nov 23, 2018
bd0f693
test for factory
Nov 23, 2018
4c0f8de
WIP
adamdossa Nov 24, 2018
191b788
WIP
adamdossa Nov 24, 2018
9f0e2ef
Fixes
adamdossa Nov 24, 2018
3234d15
Update config
adamdossa Nov 24, 2018
14d5890
Log gas for 50 txs
adamdossa Nov 24, 2018
a278476
WIP
adamdossa Nov 24, 2018
165f6c7
update
adamdossa Nov 24, 2018
f121696
Fix tests
adamdossa Nov 25, 2018
0947697
Fix typo
adamdossa Nov 25, 2018
af1a97e
Change onWhitelist logic
adamdossa Nov 25, 2018
75fcc37
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Nov 25, 2018
67037aa
Update changelog
adamdossa Nov 25, 2018
492127f
Update all test cases
adamdossa Nov 25, 2018
704751d
Add whitelist optimization
maxsam4 Nov 26, 2018
babb4cb
Make Dividend modules proxies
adamdossa Nov 26, 2018
bd6b2de
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Nov 26, 2018
0c19bf2
Updates
adamdossa Nov 26, 2018
c2b44c2
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
adamdossa Nov 26, 2018
3f60f88
minor cleanup
SatyamSB Nov 27, 2018
d473a2d
make script dynamic
SatyamSB Nov 27, 2018
70ec287
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
adamdossa Nov 27, 2018
b172ce6
Applied review comments (not finished)
Nov 27, 2018
82a49ba
Merge branch 'Vesting-Escrow-Wallet' of https://github.com/PolymathNe…
Nov 27, 2018
3557770
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
Nov 27, 2018
8c2b140
get rid of updateAll function
Nov 27, 2018
b416076
changes in multi-operations
Nov 28, 2018
0c49861
use msg.sender instead of _treasury
Nov 28, 2018
125a199
minor fix
Nov 28, 2018
4854ace
updated permissions_list.md
Nov 28, 2018
3c58d4f
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Nov 28, 2018
e9f1129
fixed permissions_list.md
Nov 28, 2018
cb975a5
Keep ABI constant
adamdossa Nov 28, 2018
37aafb8
Fixes
adamdossa Nov 28, 2018
08cf843
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Nov 28, 2018
2988663
Update change log
adamdossa Nov 28, 2018
dd62de4
data structure refactoring
Nov 29, 2018
4c4c9ad
refactored revokeSchedule()
Nov 29, 2018
11b000e
contract size optimization
Nov 29, 2018
21a55c1
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
satyamakgec Nov 30, 2018
a3f46e5
fixes in the code
SatyamSB Nov 30, 2018
6d12750
test fixes - data structure refactoring (not finished)
Nov 30, 2018
976e6d6
removed trim function, changed pushAvailableTokensMulti
Nov 30, 2018
b9df9cb
minor fixes with treasury
Nov 30, 2018
b563fe0
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Nov 30, 2018
861fbea
Updates
adamdossa Nov 30, 2018
11702df
adopting the optimisation deployment of factory
SatyamSB Dec 3, 2018
2026bca
add require statement in factory constructors
SatyamSB Dec 3, 2018
df121ea
test fixes - data structure refactoring
Dec 3, 2018
998ce57
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Dec 3, 2018
c3a64ac
minor fix in tests
Dec 3, 2018
ff45016
remove the test cases for the STVRTM
SatyamSB Dec 3, 2018
9af5899
Return investor data in getAllInvestorsData
adamdossa Dec 3, 2018
e394850
CLI changes according GTM optimizations
VictorVicente Dec 3, 2018
071a59d
Merge branch 'dev-2.1.0' into Optimise-GTM
VictorVicente Dec 3, 2018
04f02c1
Bump versions
adamdossa Dec 3, 2018
847c0ff
version changes
SatyamSB Dec 4, 2018
fcbb93d
updated doc for getSchedule
Dec 4, 2018
e9eb308
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
Dec 4, 2018
ed96442
resolve conflicts from the DM local changes
SatyamSB Dec 4, 2018
7cf5c59
Update CHANGELOG.md
pabloruiz55 Dec 4, 2018
0739213
Merge branch 'dev-2.1.0' into Optimise-GTM
pabloruiz55 Dec 4, 2018
ee5bbed
Merge branch 'dev-2.1.0' into Optimise-GTM
adamdossa Dec 4, 2018
59e225c
Merge branch 'Optimise-GTM' into Vesting-Escrow-Wallet
SatyamSB Dec 5, 2018
6f0bed7
VEW deployable by proxy
SatyamSB Dec 5, 2018
8a89262
minor fix
SatyamSB Dec 5, 2018
137e6eb
small fix in the pushAvalilableTokensMulti
SatyamSB Dec 5, 2018
7ca40a4
resolve conflicts in the migrations
SatyamSB Dec 5, 2018
f306902
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
adamdossa Dec 10, 2018
c7c16ec
Applied review comments
Dec 10, 2018
affcf54
remove the irrevalent if conditions
SatyamSB Dec 10, 2018
425f3bf
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
satyamakgec Dec 10, 2018
bb48255
resolve conflicts
SatyamSB Dec 10, 2018
40ab59b
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
satyamakgec Dec 11, 2018
af0ab90
Improved the natspec comments
Dec 18, 2018
9088434
added VestingEscrowWalletLogic to output
Dec 19, 2018
df1d920
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
VictorVicente Jan 2, 2019
3b78ff7
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
VictorVicente Jan 3, 2019
0ecdf79
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
VictorVicente Jan 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions contracts/modules/Wallet/IWallet.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pragma solidity ^0.4.24;

import "../../Pausable.sol";
import "../Module.sol";

/**
* @title Interface to be implemented by all Wallet modules
* @dev abstract contract
*/
contract IWallet is Module, Pausable {

function unpause() public onlyOwner {
super._unpause();
}

function pause() public onlyOwner {
super._pause();
}
}
558 changes: 558 additions & 0 deletions contracts/modules/Wallet/VestingEscrowWallet.sol

Large diffs are not rendered by default.

76 changes: 76 additions & 0 deletions contracts/modules/Wallet/VestingEscrowWalletFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
pragma solidity ^0.4.24;

import "../../proxy/VestingEscrowWalletProxy.sol";
import "../../interfaces/IBoot.sol";
import "../ModuleFactory.sol";
import "../../libraries/Util.sol";

/**
* @title Factory for deploying VestingEscrowWallet module
*/
contract VestingEscrowWalletFactory is ModuleFactory {

address public logicContract;
/**
* @notice Constructor
* @param _polyAddress Address of the polytoken
*/
constructor (address _polyAddress, uint256 _setupCost, uint256 _usageCost, uint256 _subscriptionCost, address _logicContract) public
ModuleFactory(_polyAddress, _setupCost, _usageCost, _subscriptionCost)
{
require(_logicContract != address(0), "Invalid address");
version = "1.0.0";
name = "VestingEscrowWallet";
title = "Vesting Escrow Wallet";
description = "Manage vesting schedules to employees / affiliates";
compatibleSTVersionRange["lowerBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0));
compatibleSTVersionRange["upperBound"] = VersionUtils.pack(uint8(0), uint8(0), uint8(0));
logicContract = _logicContract;
}

/**
* @notice Used to launch the Module with the help of factory
* _data Data used for the intialization of the module factory variables
* @return address Contract address of the Module
*/
function deploy(bytes _data) external returns(address) {
if (setupCost > 0) {
require(polyToken.transferFrom(msg.sender, owner, setupCost), "Failed transferFrom due to insufficent Allowance provided");
}
VestingEscrowWalletProxy vestingEscrowWallet = new VestingEscrowWalletProxy(msg.sender, address(polyToken), logicContract);
//Checks that _data is valid (not calling anything it shouldn't)
require(Util.getSig(_data) == IBoot(vestingEscrowWallet).getInitFunction(), "Invalid data");
/*solium-disable-next-line security/no-low-level-calls*/
require(address(vestingEscrowWallet).call(_data), "Unsuccessfull call");
/*solium-disable-next-line security/no-block-members*/
emit GenerateModuleFromFactory(address(vestingEscrowWallet), getName(), address(this), msg.sender, setupCost, now);
return address(vestingEscrowWallet);
}

/**
* @notice Type of the Module factory
*/
function getTypes() external view returns(uint8[]) {
uint8[] memory res = new uint8[](1);
res[0] = 6;
return res;
}

/**
* @notice Returns the instructions associated with the module
*/
function getInstructions() external view returns(string) {
/*solium-disable-next-line max-len*/
return "Issuer can deposit tokens to the contract and create the vesting schedule for the given address (Affiliate/Employee). These address can withdraw tokens according to there vesting schedule.";
}

/**
* @notice Get the tags related to the module factory
*/
function getTags() external view returns(bytes32[]) {
bytes32[] memory availableTags = new bytes32[](2);
availableTags[0] = "Vested";
availableTags[1] = "Escrow Wallet";
return availableTags;
}
}
54 changes: 54 additions & 0 deletions contracts/modules/Wallet/VestingEscrowWalletStorage.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
pragma solidity ^0.4.24;

/**
* @title Wallet for core vesting escrow functionality
*/
contract VestingEscrowWalletStorage {

struct Schedule {
// Name of the template
bytes32 templateName;
// Tokens that were already claimed
uint256 claimedTokens;
// Start time of the schedule
uint256 startTime;
}

struct Template {
// Total amount of tokens
uint256 numberOfTokens;
// Schedule duration (How long the schedule will last)
uint256 duration;
// Schedule frequency (It is a cliff time period)
uint256 frequency;
// Index of the template in an array template names
uint256 index;
}

// Number of tokens that are hold by the `this` contract but are unassigned to any schedule
uint256 public unassignedTokens;
// Address of the Treasury wallet. All of the unassigned token will transfer to that address.
address public treasuryWallet;
// List of all beneficiaries who have the schedules running/completed/created
address[] public beneficiaries;
// Flag whether beneficiary has been already added or not
mapping(address => bool) internal beneficiaryAdded;

// Holds schedules array corresponds to the affiliate/employee address
mapping(address => Schedule[]) public schedules;
// Holds template names array corresponds to the affiliate/employee address
mapping(address => bytes32[]) internal userToTemplates;
// Mapping use to store the indexes for different template names for a user.
// affiliate/employee address => template name => index
mapping(address => mapping(bytes32 => uint256)) internal userToTemplateIndex;
// Holds affiliate/employee addresses coressponds to the template name
mapping(bytes32 => address[]) internal templateToUsers;
// Mapping use to store the indexes for different users for a template.
// template name => affiliate/employee address => index
mapping(bytes32 => mapping(address => uint256)) internal templateToUserIndex;
// Store the template details corresponds to the template name
mapping(bytes32 => Template) templates;

// List of all template names
bytes32[] public templateNames;
}
27 changes: 27 additions & 0 deletions contracts/proxy/VestingEscrowWalletProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pragma solidity ^0.4.24;

import "../modules/Wallet/VestingEscrowWalletStorage.sol";
import "./OwnedProxy.sol";
import "../Pausable.sol";
import "../modules/ModuleStorage.sol";
/**
* @title Escrow wallet module for vesting functionality
*/
contract VestingEscrowWalletProxy is VestingEscrowWalletStorage, ModuleStorage, Pausable, OwnedProxy {
/**
* @notice Constructor
* @param _securityToken Address of the security token
* @param _polyAddress Address of the polytoken
* @param _implementation representing the address of the new implementation to be set
*/
constructor (address _securityToken, address _polyAddress, address _implementation)
public
ModuleStorage(_securityToken, _polyAddress)
{
require(
_implementation != address(0),
"Implementation address should not be 0x"
);
__implementation = _implementation;
}
}
53 changes: 53 additions & 0 deletions docs/permissions_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,60 @@
</tr>
<tr>
<td> removeTransferLimitInPercentageMulti </td>
</tr>
<tr></tr>
<tr>
<td rowspan=16>Wallet</td>
<td rowspan=16>VestingEscrowWallet</td>
<td>changeTreasuryWallet()</td>
<td>onlyOwner</td>
</tr>
<tr>
<td>depositTokens()</td>
<td rowspan=15>withPerm(ADMIN)</td>
</tr>
<tr>
<td>sendToTreasury()</td>
</tr>
<tr>
<td>pushAvailableTokens()</td>
</tr>
<tr>
<td>addTemplate()</td>
</tr>
<tr>
<td>removeTemplate()</td>
</tr>
<tr>
<td>addSchedule()</td>
</tr>
<tr>
<td>addScheduleFromTemplate()</td>
</tr>
<tr>
<td>modifySchedule()</td>
</tr>
<tr>
<td>revokeSchedule()</td>
</tr>
<tr>
<td>revokeAllSchedules()</td>
</tr>
<tr>
<td>pushAvailableTokensMulti()</td>
</tr>
<tr>
<td>addScheduleMulti()</td>
</tr>
<tr>
<td>addScheduleFromTemplateMulti()</td>
</tr>
<tr>
<td>revokeSchedulesMulti()</td>
</tr>
<tr>
<td>modifyScheduleMulti()</td>
</tr>
</tbody>
</table>

Expand Down
25 changes: 23 additions & 2 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const EtherDividendCheckpointLogic = artifacts.require('./EtherDividendCheckpoin
const ERC20DividendCheckpointLogic = artifacts.require('./ERC20DividendCheckpoint.sol')
const EtherDividendCheckpointFactory = artifacts.require('./EtherDividendCheckpointFactory.sol')
const ERC20DividendCheckpointFactory = artifacts.require('./ERC20DividendCheckpointFactory.sol')
const VestingEscrowWalletFactory = artifacts.require('./VestingEscrowWalletFactory.sol');
const VestingEscrowWalletLogic = artifacts.require('./VestingEscrowWallet.sol');
const ModuleRegistry = artifacts.require('./ModuleRegistry.sol');
const ModuleRegistryProxy = artifacts.require('./ModuleRegistryProxy.sol');
const ManualApprovalTransferManagerFactory = artifacts.require('./ManualApprovalTransferManagerFactory.sol')
Expand Down Expand Up @@ -154,17 +156,25 @@ module.exports = function (deployer, network, accounts) {
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(GeneralTransferManagerLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount});
}).then(() => {
// B) Deploy the GeneralTransferManagerLogic Contract (Factory used to generate the GeneralTransferManager contract and this
// B) Deploy the ERC20DividendCheckpointLogic Contract (Factory used to generate the ERC20DividendCheckpoint contract and this
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(ERC20DividendCheckpointLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount});
}).then(() => {
// B) Deploy the GeneralTransferManagerLogic Contract (Factory used to generate the GeneralTransferManager contract and this
// B) Deploy the EtherDividendCheckpointLogic Contract (Factory used to generate the EtherDividendCheckpoint contract and this
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(EtherDividendCheckpointLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount});
}).then(() => {
// B) Deploy the VestingEscrowWalletLogic Contract (Factory used to generate the VestingEscrowWallet contract and this
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(VestingEscrowWalletLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount});
}).then(() => {
// B) Deploy the USDTieredSTOLogic Contract (Factory used to generate the USDTieredSTO contract and this
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(USDTieredSTOLogic, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", {from: PolymathAccount});
}).then(() => {
// B) Deploy the VestingEscrowWalletFactory Contract (Factory used to generate the VestingEscrowWallet contract and this
// manager attach with the securityToken contract at the time of deployment)
return deployer.deploy(VestingEscrowWalletFactory, PolyToken, 0, 0, 0, VestingEscrowWalletLogic.address, {from: PolymathAccount});
}).then(() => {
// B) Deploy the GeneralTransferManagerFactory Contract (Factory used to generate the GeneralTransferManager contract and this
// manager attach with the securityToken contract at the time of deployment)
Expand Down Expand Up @@ -220,6 +230,10 @@ module.exports = function (deployer, network, accounts) {
// D) Register the PercentageTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level.
// So any securityToken can use that factory to generate the PercentageTransferManager contract.
return moduleRegistry.registerModule(PercentageTransferManagerFactory.address, {from: PolymathAccount});
}).then(() => {
// D) Register the VestingEscrowWalletFactory in the ModuleRegistry to make the factory available at the protocol level.
// So any securityToken can use that factory to generate the VestingEscrowWallet contract.
return moduleRegistry.registerModule(VestingEscrowWalletFactory.address, {from: PolymathAccount});
}).then(() => {
// D) Register the CountTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level.
// So any securityToken can use that factory to generate the CountTransferManager contract.
Expand Down Expand Up @@ -279,6 +293,11 @@ module.exports = function (deployer, network, accounts) {
// contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only.
// Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts.
return moduleRegistry.verifyModule(ManualApprovalTransferManagerFactory.address, true, {from: PolymathAccount});
}).then(() => {
// F) Once the VestingEscrowWalletFactory registered with the ModuleRegistry contract then for making them accessble to the securityToken
// contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only.
// Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts.
return moduleRegistry.verifyModule(VestingEscrowWalletFactory.address, true, {from: PolymathAccount});
}).then(() => {
// M) Deploy the CappedSTOFactory (Use to generate the CappedSTO contract which will used to collect the funds ).
return deployer.deploy(CappedSTOFactory, PolyToken, cappedSTOSetupCost, 0, 0, {from: PolymathAccount})
Expand Down Expand Up @@ -337,6 +356,8 @@ module.exports = function (deployer, network, accounts) {
ERC20DividendCheckpointLogic: ${ERC20DividendCheckpointLogic.address}
EtherDividendCheckpointFactory: ${EtherDividendCheckpointFactory.address}
ERC20DividendCheckpointFactory: ${ERC20DividendCheckpointFactory.address}
VestingEscrowWalletFactory: ${VestingEscrowWalletFactory.address}
VestingEscrowWalletLogic: ${VestingEscrowWalletLogic.address}
---------------------------------------------------------------------------------
`);
console.log('\n');
Expand Down
21 changes: 18 additions & 3 deletions test/helpers/createInstances.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const PolyTokenFaucet = artifacts.require("./PolyTokenFaucet.sol");
const DummySTOFactory = artifacts.require("./DummySTOFactory.sol");
const MockBurnFactory = artifacts.require("./MockBurnFactory.sol");
const MockWrongTypeFactory = artifacts.require("./MockWrongTypeFactory.sol");
const VestingEscrowWalletFactory = artifacts.require("./VestingEscrowWalletFactory.sol");
const VestingEscrowWallet = artifacts.require("./VestingEscrowWallet.sol");

const Web3 = require("web3");
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); // Hardcoded development port
Expand All @@ -54,6 +56,7 @@ let I_ERC20DividendCheckpointFactory;
let I_GeneralPermissionManagerFactory;
let I_GeneralTransferManagerLogic;
let I_GeneralTransferManagerFactory;
let I_VestingEscrowWalletFactory;
let I_GeneralTransferManager;
let I_ModuleRegistryProxy;
let I_PreSaleSTOFactory;
Expand All @@ -68,6 +71,7 @@ let I_STFactory;
let I_USDTieredSTOLogic;
let I_PolymathRegistry;
let I_SecurityTokenRegistryProxy;
let I_VestingEscrowWalletLogic;
let I_STRProxied;
let I_MRProxied;

Expand Down Expand Up @@ -104,7 +108,7 @@ export async function setUpPolymathNetwork(account_polymath, token_owner) {
}


async function deployPolyRegistryAndPolyToken(account_polymath, token_owner) {
export async function deployPolyRegistryAndPolyToken(account_polymath, token_owner) {
// Step 0: Deploy the PolymathRegistry
I_PolymathRegistry = await PolymathRegistry.new({ from: account_polymath });

Expand Down Expand Up @@ -404,6 +408,19 @@ export async function deployRedemptionAndVerifyed(accountPolymath, MRProxyInstan
return new Array(I_TrackedRedemptionFactory);
}

export async function deployVestingEscrowWalletAndVerifyed(accountPolymath, MRProxyInstance, polyToken, setupCost) {
I_VestingEscrowWalletLogic = await VestingEscrowWallet.new("0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", { from: accountPolymath });
I_VestingEscrowWalletFactory = await VestingEscrowWalletFactory.new(polyToken, setupCost, 0, 0, I_VestingEscrowWalletLogic.address, { from: accountPolymath });

assert.notEqual(
I_VestingEscrowWalletFactory.address.valueOf(),
"0x0000000000000000000000000000000000000000",
"VestingEscrowWalletFactory contract was not deployed"
);

await registerAndVerifyByMR(I_VestingEscrowWalletFactory.address, accountPolymath, MRProxyInstance);
return new Array(I_VestingEscrowWalletFactory);
}

export async function deployMockRedemptionAndVerifyed(accountPolymath, MRProxyInstance, polyToken, setupCost) {
I_MockBurnFactory = await MockBurnFactory.new(polyToken, setupCost, 0, 0, { from: accountPolymath });
Expand Down Expand Up @@ -431,8 +448,6 @@ export async function deployMockWrongTypeRedemptionAndVerifyed(accountPolymath,
return new Array(I_MockWrongTypeBurnFactory);
}



/// Helper function
function mergeReturn(returnData) {
let returnArray = new Array();
Expand Down
3 changes: 3 additions & 0 deletions test/helpers/exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ module.exports = {
catchRevert: async function(promise) {
await tryCatch(promise, "revert");
},
catchPermission: async function(promise) {
await tryCatch(promise, "revert Permission check failed");
},
catchOutOfGas: async function(promise) {
await tryCatch(promise, "out of gas");
},
Expand Down
Loading