@@ -7,17 +7,17 @@ import {
7
7
SecurityTokenEvents ,
8
8
} from '@polymathnetwork/contract-wrappers' ;
9
9
import * as contractWrappersModule from '@polymathnetwork/contract-wrappers' ;
10
- import { LaunchUsdTieredSto } from '../../procedures/LaunchUsdTieredSto ' ;
10
+ import { LaunchTieredSto } from '../../procedures/LaunchTieredSto ' ;
11
11
import { Procedure } from '../Procedure' ;
12
12
import { PolymathError } from '../../PolymathError' ;
13
13
import {
14
14
ErrorCode ,
15
- LaunchUsdTieredStoProcedureArgs ,
15
+ LaunchTieredStoProcedureArgs ,
16
16
PolyTransactionTag ,
17
17
ProcedureType ,
18
18
StoType ,
19
19
} from '../../types' ;
20
- import * as usdTieredStoFactoryModule from '~/entities/factories/UsdTieredStoFactory ' ;
20
+ import * as tieredStoFactoryModule from '~/entities/factories/TieredStoFactory ' ;
21
21
import * as utilsModule from '../../utils' ;
22
22
import * as contextModule from '../../Context' ;
23
23
import * as wrappersModule from '../../PolymathBase' ;
@@ -26,14 +26,14 @@ import * as moduleWrapperFactoryModule from '../../testUtils/MockedModuleWrapper
26
26
import { Wallet } from '../../Wallet' ;
27
27
import { TransferErc20 } from '../../procedures' ;
28
28
import { mockFactories } from '../../testUtils/mockFactories' ;
29
- import { SecurityToken , UsdTieredSto } from '../../entities' ;
29
+ import { SecurityToken , TieredSto } from '../../entities' ;
30
30
31
- const params : LaunchUsdTieredStoProcedureArgs = {
31
+ const params : LaunchTieredStoProcedureArgs = {
32
32
symbol : 'TEST1' ,
33
33
startDate : new Date ( 2030 , 1 ) ,
34
34
endDate : new Date ( 2031 , 1 ) ,
35
- storageWallet : '0x5555555555555555555555555555555555555555' ,
36
- treasuryWallet : '0x6666666666666666666666666666666666666666' ,
35
+ raisedFundsWallet : '0x5555555555555555555555555555555555555555' ,
36
+ unsoldTokensWallet : '0x6666666666666666666666666666666666666666' ,
37
37
tiers : [
38
38
{
39
39
tokensOnSale : new BigNumber ( 1 ) ,
@@ -43,18 +43,18 @@ const params: LaunchUsdTieredStoProcedureArgs = {
43
43
nonAccreditedInvestmentLimit : new BigNumber ( 1 ) ,
44
44
minimumInvestment : new BigNumber ( 1 ) ,
45
45
currencies : [ Currency . StableCoin ] ,
46
- usdTokenAddresses : [ '0x7777777777777777777777777777777777777777' ] ,
46
+ stableCoinAddresses : [ '0x7777777777777777777777777777777777777777' ] ,
47
47
} ;
48
48
49
49
const currentWallet = '0x8888888888888888888888888888888888888888' ;
50
50
const securityTokenAddress = '0x9999999999999999999999999999999999999999' ;
51
51
const polyTokenAddress = '0x5555555555555555555555555555555555555555' ;
52
52
const moduleFactoryAddress = '0x4444444444444444444444444444444444444444' ;
53
53
const costInPoly = new BigNumber ( 5 ) ;
54
- const costInUsd = new BigNumber ( 6 ) ;
54
+ const costIn = new BigNumber ( 6 ) ;
55
55
56
- describe ( 'LaunchUsdTieredSto ' , ( ) => {
57
- let target : LaunchUsdTieredSto ;
56
+ describe ( 'LaunchTieredSto ' , ( ) => {
57
+ let target : LaunchTieredSto ;
58
58
let contextMock : MockManager < contextModule . Context > ;
59
59
let wrappersMock : MockManager < wrappersModule . PolymathBase > ;
60
60
let tokenFactoryMock : MockManager < tokenFactoryModule . MockedTokenFactoryModule > ;
@@ -66,7 +66,7 @@ describe('LaunchUsdTieredSto', () => {
66
66
let moduleWrapperFactoryStub : SinonStub < any , any > ;
67
67
68
68
// Mock factories
69
- let usdTieredStoFactoryMock : MockManager < usdTieredStoFactoryModule . UsdTieredStoFactory > ;
69
+ let tieredStoFactoryMock : MockManager < tieredStoFactoryModule . TieredStoFactory > ;
70
70
71
71
let securityTokenMock : MockManager < contractWrappersModule . SecurityToken_3_0_0 > ;
72
72
let moduleFactoryMock : MockManager < contractWrappersModule . ModuleFactory_3_0_0 > ;
@@ -75,7 +75,7 @@ describe('LaunchUsdTieredSto', () => {
75
75
let getAttachedModulesFactoryAddressStub : SinonStub < any , any > ;
76
76
77
77
beforeEach ( ( ) => {
78
- // Mock the context, wrappers, and tokenFactory to test LaunchUsdTieredSto
78
+ // Mock the context, wrappers, and tokenFactory to test LaunchTieredSto
79
79
contextMock = ImportMock . mockClass ( contextModule , 'Context' ) ;
80
80
wrappersMock = ImportMock . mockClass ( wrappersModule , 'PolymathBase' ) ;
81
81
tokenFactoryMock = ImportMock . mockClass ( tokenFactoryModule , 'MockedTokenFactoryModule' ) ;
@@ -95,7 +95,7 @@ describe('LaunchUsdTieredSto', () => {
95
95
moduleFactoryMock = ImportMock . mockClass ( contractWrappersModule , 'ModuleFactory_3_0_0' ) ;
96
96
moduleFactoryMock . mock ( 'setupCostInPoly' , Promise . resolve ( costInPoly ) ) ;
97
97
moduleFactoryMock . mock ( 'isCostInPoly' , Promise . resolve ( false ) ) ;
98
- moduleFactoryMock . mock ( 'setupCost' , Promise . resolve ( costInUsd ) ) ;
98
+ moduleFactoryMock . mock ( 'setupCost' , Promise . resolve ( costIn ) ) ;
99
99
100
100
tokenFactoryStub = tokenFactoryMock . mock (
101
101
'getSecurityTokenInstanceFromTicker' ,
@@ -105,13 +105,10 @@ describe('LaunchUsdTieredSto', () => {
105
105
'getModuleFactory' ,
106
106
moduleFactoryMock . getMockInstance ( )
107
107
) ;
108
- usdTieredStoFactoryMock = ImportMock . mockClass (
109
- usdTieredStoFactoryModule ,
110
- 'UsdTieredStoFactory'
111
- ) ;
108
+ tieredStoFactoryMock = ImportMock . mockClass ( tieredStoFactoryModule , 'TieredStoFactory' ) ;
112
109
113
110
const factoryMockSetup = mockFactories ( ) ;
114
- factoryMockSetup . usdTieredStoFactory = usdTieredStoFactoryMock . getMockInstance ( ) ;
111
+ factoryMockSetup . tieredStoFactory = tieredStoFactoryMock . getMockInstance ( ) ;
115
112
contextMock . set ( 'factories' , factoryMockSetup ) ;
116
113
contextMock . set ( 'currentWallet' , new Wallet ( { address : ( ) => Promise . resolve ( currentWallet ) } ) ) ;
117
114
@@ -127,21 +124,21 @@ describe('LaunchUsdTieredSto', () => {
127
124
Promise . resolve ( moduleFactoryAddress )
128
125
) ;
129
126
130
- // Instantiate LaunchUsdTieredSto
131
- target = new LaunchUsdTieredSto ( params , contextMock . getMockInstance ( ) ) ;
127
+ // Instantiate LaunchTieredSto
128
+ target = new LaunchTieredSto ( params , contextMock . getMockInstance ( ) ) ;
132
129
} ) ;
133
130
afterEach ( ( ) => {
134
131
restore ( ) ;
135
132
} ) ;
136
133
137
134
describe ( 'Types' , ( ) => {
138
- test ( 'should extend procedure and have LaunchUsdTieredSto type' , async ( ) => {
135
+ test ( 'should extend procedure and have LaunchTieredSto type' , async ( ) => {
139
136
expect ( target instanceof Procedure ) . toBe ( true ) ;
140
- expect ( target . type ) . toBe ( ProcedureType . LaunchUsdTieredSto ) ;
137
+ expect ( target . type ) . toBe ( ProcedureType . LaunchTieredSto ) ;
141
138
} ) ;
142
139
} ) ;
143
140
144
- describe ( 'LaunchUsdTieredSto ' , ( ) => {
141
+ describe ( 'LaunchTieredSto ' , ( ) => {
145
142
test ( 'should add the transaction to the queue to launch usd tiered sto and add a procedure to transfer erc20 token' , async ( ) => {
146
143
const addProcedureSpy = spy ( target , 'addProcedure' ) ;
147
144
const addTransactionSpy = spy ( target , 'addTransaction' ) ;
@@ -157,12 +154,10 @@ describe('LaunchUsdTieredSto', () => {
157
154
. calledWith ( securityTokenMock . getMockInstance ( ) . addModuleWithLabel )
158
155
) . toEqual ( true ) ;
159
156
expect ( addTransactionSpy . getCall ( 0 ) . lastArg . fees ) . toEqual ( {
160
- usd : costInUsd ,
157
+ usd : costIn ,
161
158
poly : costInPoly ,
162
159
} ) ;
163
- expect ( addTransactionSpy . getCall ( 0 ) . lastArg . tag ) . toEqual (
164
- PolyTransactionTag . EnableUsdTieredSto
165
- ) ;
160
+ expect ( addTransactionSpy . getCall ( 0 ) . lastArg . tag ) . toEqual ( PolyTransactionTag . EnableTieredSto ) ;
166
161
expect ( addTransactionSpy . callCount ) . toEqual ( 1 ) ;
167
162
expect ( addProcedureSpy . getCall ( 0 ) . calledWithExactly ( TransferErc20 ) ) . toEqual ( true ) ;
168
163
expect ( addProcedureSpy . callCount ) . toEqual ( 1 ) ;
@@ -187,9 +182,7 @@ describe('LaunchUsdTieredSto', () => {
187
182
usd : null ,
188
183
poly : costInPoly ,
189
184
} ) ;
190
- expect ( addTransactionSpy . getCall ( 0 ) . lastArg . tag ) . toEqual (
191
- PolyTransactionTag . EnableUsdTieredSto
192
- ) ;
185
+ expect ( addTransactionSpy . getCall ( 0 ) . lastArg . tag ) . toEqual ( PolyTransactionTag . EnableTieredSto ) ;
193
186
expect ( addTransactionSpy . callCount ) . toEqual ( 1 ) ;
194
187
expect ( addProcedureSpy . getCall ( 0 ) . calledWithExactly ( TransferErc20 ) ) . toEqual ( true ) ;
195
188
expect ( addProcedureSpy . callCount ) . toEqual ( 1 ) ;
@@ -205,18 +198,18 @@ describe('LaunchUsdTieredSto', () => {
205
198
new PolymathError ( {
206
199
code : ErrorCode . UnexpectedEventLogs ,
207
200
message :
208
- "The USD Tiered STO was successfully launched but the corresponding event wasn't fired. Please report this issue to the Polymath team." ,
201
+ "The Tiered STO was successfully launched but the corresponding event wasn't fired. Please report this issue to the Polymath team." ,
209
202
} )
210
203
) ;
211
204
} ) ;
212
205
213
206
test ( 'should return the usd tiered sto object information' , async ( ) => {
214
207
const stoObject = {
215
208
securityTokenId : params . symbol ,
216
- stoType : StoType . UsdTiered ,
209
+ stoType : StoType . Tiered ,
217
210
address : securityTokenAddress ,
218
211
} ;
219
- const fetchStub = usdTieredStoFactoryMock . mock ( 'fetch' , Promise . resolve ( stoObject ) ) ;
212
+ const fetchStub = tieredStoFactoryMock . mock ( 'fetch' , Promise . resolve ( stoObject ) ) ;
220
213
const moduleAddress = '0x3333333333333333333333333333333333333333' ;
221
214
findEventsStub = ImportMock . mockFunction ( utilsModule , 'findEvents' , [
222
215
{
@@ -235,11 +228,11 @@ describe('LaunchUsdTieredSto', () => {
235
228
// Verification for fetch
236
229
expect (
237
230
fetchStub . getCall ( 0 ) . calledWithExactly (
238
- UsdTieredSto . generateId ( {
231
+ TieredSto . generateId ( {
239
232
securityTokenId : SecurityToken . generateId ( {
240
233
symbol : params . symbol ,
241
234
} ) ,
242
- stoType : StoType . UsdTiered ,
235
+ stoType : StoType . Tiered ,
243
236
address : moduleAddress ,
244
237
} )
245
238
)
0 commit comments