Skip to content

Commit 06e719f

Browse files
committed
refactor: rename UsdTieredSto to TieredSto
This is in line with changes to the smart contracts which will allow Tiered STOs to raise funds in any denomination BREAKING CHANGE: entity `UsdTieredSto` rernamed to `TieredSto`, enum `StoType.UsdTiered` changed to `StoType.Tiered`
1 parent 750ace1 commit 06e719f

File tree

12 files changed

+63
-63
lines changed

12 files changed

+63
-63
lines changed

src/Context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Erc20TokenBalanceFactory,
77
InvestmentFactory,
88
CappedStoFactory,
9-
UsdTieredStoFactory,
9+
TieredStoFactory,
1010
DividendDistributionFactory,
1111
CheckpointFactory,
1212
Erc20DividendsManagerFactory,
@@ -25,7 +25,7 @@ interface Factories {
2525
erc20TokenBalanceFactory: Erc20TokenBalanceFactory;
2626
investmentFactory: InvestmentFactory;
2727
cappedStoFactory: CappedStoFactory;
28-
usdTieredStoFactory: UsdTieredStoFactory;
28+
tieredStoFactory: TieredStoFactory;
2929
dividendDistributionFactory: DividendDistributionFactory;
3030
checkpointFactory: CheckpointFactory;
3131
erc20DividendsManagerFactory: Erc20DividendsManagerFactory;
@@ -61,7 +61,7 @@ export class Context {
6161
erc20TokenBalanceFactory: new Erc20TokenBalanceFactory(this),
6262
investmentFactory: new InvestmentFactory(this),
6363
cappedStoFactory: new CappedStoFactory(this),
64-
usdTieredStoFactory: new UsdTieredStoFactory(this),
64+
tieredStoFactory: new TieredStoFactory(this),
6565
dividendDistributionFactory: new DividendDistributionFactory(this),
6666
checkpointFactory: new CheckpointFactory(this),
6767
erc20DividendsManagerFactory: new Erc20DividendsManagerFactory(this),

src/entities/SecurityToken/Offerings.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { BigNumber, ModuleName } from '@polymathnetwork/contract-wrappers';
22
import { includes } from 'lodash';
33
import { SubModule } from './SubModule';
44
import { CappedStoCurrency, StoTier, Currency, StoType, ErrorCode } from '../../types';
5-
import { LaunchCappedSto, LaunchUsdTieredSto } from '../../procedures';
6-
import { CappedSto, UsdTieredSto, Sto } from '..';
5+
import { LaunchCappedSto, LaunchTieredSto } from '../../procedures';
6+
import { CappedSto, TieredSto, Sto } from '..';
77
import { PolymathError } from '../../PolymathError';
88

99
interface GetSto {
1010
(args: { stoType: StoType.Capped; address: string }): Promise<CappedSto>;
11-
(args: { stoType: StoType.UsdTiered; address: string }): Promise<UsdTieredSto>;
12-
(args: string): Promise<CappedSto | UsdTieredSto>;
11+
(args: { stoType: StoType.Tiered; address: string }): Promise<TieredSto>;
12+
(args: string): Promise<CappedSto | TieredSto>;
1313
}
1414

1515
export class Offerings extends SubModule {
@@ -47,24 +47,24 @@ export class Offerings extends SubModule {
4747
};
4848

4949
/**
50-
* Launch a USD Tiered STO
50+
* Launch a Tiered STO
5151
*
5252
* @param startDate date when the STO should start
5353
* @param endDate date when the STO should end
5454
* @param tiers tier information
5555
* @param tiers[].tokensOnSale amount of tokens to be sold on that tier
56-
* @param tiers[].price price of each token on that tier in USD
56+
* @param tiers[].price price of each token on that tier
5757
* @param tiers[].tokensWithDiscount amount of tokens to be sold on that tier at a discount if paid in POLY (must be less than tokensOnSale, defaults to 0)
5858
* @param tiers[].discountedPrice price of discounted tokens on that tier (defaults to 0)
5959
* @param nonAccreditedInvestmentLimit maximum investment for non-accredited investors
6060
* @param minimumInvestment minimum investment amount
6161
* @param currencies array of currencies in which the funds will be raised (ETH, POLY, StableCoin)
6262
* @param storageWallet wallet address that will receive the funds that are being raised
6363
* @param treasuryWallet wallet address that will receive unsold tokens when the end date is reached
64-
* @param usdTokenAddresses array of USD stable coins that the offering supports
64+
* @param stableCoinAddresses array of stable coins that the offering supports
6565
*
6666
*/
67-
public launchUsdTieredSto = async (args: {
67+
public launchTieredSto = async (args: {
6868
startDate: Date;
6969
endDate: Date;
7070
tiers: StoTier[];
@@ -73,11 +73,11 @@ export class Offerings extends SubModule {
7373
currencies: Currency[];
7474
storageWallet: string;
7575
treasuryWallet: string;
76-
usdTokenAddresses: string[];
76+
stableCoinAddresses: string[];
7777
}) => {
7878
const { context, securityToken } = this;
7979
const { symbol } = securityToken;
80-
const procedure = new LaunchUsdTieredSto(
80+
const procedure = new LaunchTieredSto(
8181
{
8282
symbol,
8383
...args,
@@ -90,7 +90,7 @@ export class Offerings extends SubModule {
9090
/**
9191
* Retrieve an STO by type and address or UUID
9292
*
93-
* @param stoType type of the STO (Capped or USDTiered)
93+
* @param stoType type of the STO (Capped or Tiered)
9494
* @param address address of the STO contract
9595
*/
9696
public getSto: GetSto = async (
@@ -120,9 +120,9 @@ export class Offerings extends SubModule {
120120
return factories.cappedStoFactory.fetch(
121121
CappedSto.generateId({ securityTokenId: uid, stoType, address })
122122
);
123-
} else if (stoType === StoType.UsdTiered) {
124-
return factories.usdTieredStoFactory.fetch(
125-
UsdTieredSto.generateId({ securityTokenId: uid, stoType, address })
123+
} else if (stoType === StoType.Tiered) {
124+
return factories.tieredStoFactory.fetch(
125+
TieredSto.generateId({ securityTokenId: uid, stoType, address })
126126
);
127127
} else {
128128
throw new PolymathError({
@@ -141,7 +141,7 @@ export class Offerings extends SubModule {
141141
opts: {
142142
stoTypes: StoType[];
143143
} = {
144-
stoTypes: [StoType.Capped, StoType.UsdTiered],
144+
stoTypes: [StoType.Capped, StoType.Tiered],
145145
}
146146
) => {
147147
const { contractWrappers, factories } = this.context;
@@ -150,7 +150,7 @@ export class Offerings extends SubModule {
150150

151151
const { stoTypes } = opts;
152152

153-
let stos: Promise<CappedSto | UsdTieredSto>[] = [];
153+
let stos: Promise<CappedSto | TieredSto>[] = [];
154154

155155
if (includes(stoTypes, StoType.Capped)) {
156156
const fetchedModules = await contractWrappers.getAttachedModules(
@@ -169,7 +169,7 @@ export class Offerings extends SubModule {
169169
);
170170
}
171171

172-
if (includes(stoTypes, StoType.UsdTiered)) {
172+
if (includes(stoTypes, StoType.Tiered)) {
173173
const fetchedModules = await contractWrappers.getAttachedModules(
174174
{ symbol: securityTokenSymbol, moduleName: ModuleName.UsdTieredSTO },
175175
{ unarchived: true }
@@ -179,8 +179,8 @@ export class Offerings extends SubModule {
179179

180180
stos = stos.concat(
181181
addresses.map(address =>
182-
factories.usdTieredStoFactory.fetch(
183-
UsdTieredSto.generateId({ address, stoType: StoType.Capped, securityTokenId: uid })
182+
factories.tieredStoFactory.fetch(
183+
TieredSto.generateId({ address, stoType: StoType.Capped, securityTokenId: uid })
184184
)
185185
)
186186
);

src/entities/UsdTieredSto.ts renamed to src/entities/TieredSto.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export interface Params extends StoParams {
1515
tiers: Tier[];
1616
}
1717

18-
export class UsdTieredSto extends Sto<Params> {
18+
export class TieredSto extends Sto<Params> {
1919
public static generateId({ securityTokenId, stoType, address }: UniqueIdentifiers) {
20-
return serialize('usdTieredSto', {
20+
return serialize('tieredSto', {
2121
securityTokenId,
2222
stoType,
2323
address,
@@ -39,7 +39,7 @@ export class UsdTieredSto extends Sto<Params> {
3939

4040
this.currentTier = currentTier;
4141
this.tiers = tiers;
42-
this.uid = UsdTieredSto.generateId({ address, stoType, securityTokenId });
42+
this.uid = TieredSto.generateId({ address, stoType, securityTokenId });
4343
}
4444

4545
public toPojo() {

src/entities/factories/InvestmentFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class InvestmentFactory extends Factory<Investment, Params, UniqueIdentif
5757
investedFunds: weiToValue(value, FULL_DECIMALS),
5858
securityTokenSymbol: symbol,
5959
};
60-
} else if (stoType === StoType.UsdTiered) {
60+
} else if (stoType === StoType.Tiered) {
6161
const module = await this.context.contractWrappers.moduleFactory.getModuleInstance({
6262
name: ModuleName.UsdTieredSTO,
6363
address,

src/entities/factories/UsdTieredStoFactory.ts renamed to src/entities/factories/TieredStoFactory.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import { Context } from '../../Context';
1111
import { Currency } from '../../types';
1212
import { SecurityToken } from '../SecurityToken';
1313
import { Investment } from '../Investment';
14-
import { UsdTieredSto, Params, UniqueIdentifiers } from '../UsdTieredSto';
14+
import { TieredSto, Params, UniqueIdentifiers } from '../TieredSto';
1515

1616
const { weiToValue } = conversionUtils;
1717

18-
export class UsdTieredStoFactory extends Factory<UsdTieredSto, Params, UniqueIdentifiers> {
18+
export class TieredStoFactory extends Factory<TieredSto, Params, UniqueIdentifiers> {
1919
protected generateProperties = async (uid: string) => {
20-
const { securityTokenId, stoType, address } = UsdTieredSto.unserialize(uid);
20+
const { securityTokenId, stoType, address } = TieredSto.unserialize(uid);
2121

2222
const { symbol } = SecurityToken.unserialize(securityTokenId);
2323

@@ -59,7 +59,7 @@ export class UsdTieredStoFactory extends Factory<UsdTieredSto, Params, UniqueIde
5959
},
6060
] = await Promise.all([module.paused(), module.capReached(), module.getSTODetails()]);
6161

62-
const stoId = UsdTieredSto.generateId({
62+
const stoId = TieredSto.generateId({
6363
securityTokenId,
6464
stoType,
6565
address,
@@ -106,6 +106,6 @@ export class UsdTieredStoFactory extends Factory<UsdTieredSto, Params, UniqueIde
106106
};
107107

108108
constructor(context: Context) {
109-
super(UsdTieredSto, context);
109+
super(TieredSto, context);
110110
}
111111
}

src/entities/factories/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export { SecurityTokenReservationFactory } from './SecurityTokenReservationFacto
33
export { Erc20TokenBalanceFactory } from './Erc20TokenBalanceFactory';
44
export { InvestmentFactory } from './InvestmentFactory';
55
export { CappedStoFactory } from './CappedStoFactory';
6-
export { UsdTieredStoFactory } from './UsdTieredStoFactory';
6+
export { TieredStoFactory } from './TieredStoFactory';
77
export { DividendDistributionFactory } from './DividendDistributionFactory';
88
export { CheckpointFactory } from './CheckpointFactory';
99
export { Erc20DividendsManagerFactory } from './Erc20DividendsManagerFactory';

src/entities/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export { PolyTransaction } from './PolyTransaction';
1111
export { TransactionQueue } from './TransactionQueue';
1212
export { Erc20TokenBalance } from './Erc20TokenBalance';
1313
export { CappedSto } from './CappedSto';
14-
export { UsdTieredSto } from './UsdTieredSto';
14+
export { TieredSto } from './TieredSto';
1515
export { Investment } from './Investment';
1616
export { Sto } from './Sto';
1717
export { Shareholder } from './Shareholder';

src/procedures/LaunchUsdTieredSto.ts renamed to src/procedures/LaunchTieredSto.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import {
99
ProcedureType,
1010
PolyTransactionTag,
1111
ErrorCode,
12-
LaunchUsdTieredStoProcedureArgs,
12+
LaunchTieredStoProcedureArgs,
1313
StoType,
1414
} from '../types';
1515
import { PolymathError } from '../PolymathError';
1616
import { TransferErc20 } from './TransferErc20';
1717
import { findEvents } from '../utils';
18-
import { SecurityToken, UsdTieredSto } from '../entities';
18+
import { SecurityToken, TieredSto } from '../entities';
1919

2020
interface AddUSDTieredSTOParams {
2121
moduleName: ModuleName.UsdTieredSTO;
@@ -38,8 +38,8 @@ interface AddUSDTieredSTOParams {
3838
label?: string;
3939
}
4040

41-
export class LaunchUsdTieredSto extends Procedure<LaunchUsdTieredStoProcedureArgs, UsdTieredSto> {
42-
public type = ProcedureType.LaunchUsdTieredSto;
41+
export class LaunchTieredSto extends Procedure<LaunchTieredStoProcedureArgs, TieredSto> {
42+
public type = ProcedureType.LaunchTieredSto;
4343

4444
public async prepareTransactions() {
4545
const { args, context } = this;
@@ -53,11 +53,11 @@ export class LaunchUsdTieredSto extends Procedure<LaunchUsdTieredStoProcedureArg
5353
currencies,
5454
storageWallet,
5555
treasuryWallet,
56-
usdTokenAddresses,
56+
stableCoinAddresses,
5757
} = args;
5858
const {
5959
contractWrappers,
60-
factories: { usdTieredStoFactory },
60+
factories: { tieredStoFactory },
6161
} = context;
6262

6363
let securityToken;
@@ -117,10 +117,10 @@ export class LaunchUsdTieredSto extends Procedure<LaunchUsdTieredStoProcedureArg
117117
}
118118
);
119119

120-
const newSto = await this.addTransaction<AddUSDTieredSTOParams, UsdTieredSto>(
120+
const newSto = await this.addTransaction<AddUSDTieredSTOParams, TieredSto>(
121121
securityToken.addModuleWithLabel,
122122
{
123-
tag: PolyTransactionTag.EnableUsdTieredSto,
123+
tag: PolyTransactionTag.EnableTieredSto,
124124
fees: {
125125
usd: usdCost,
126126
poly: polyCost,
@@ -138,18 +138,18 @@ export class LaunchUsdTieredSto extends Procedure<LaunchUsdTieredStoProcedureArg
138138

139139
const { _module } = eventArgs;
140140

141-
return usdTieredStoFactory.fetch(
142-
UsdTieredSto.generateId({
141+
return tieredStoFactory.fetch(
142+
TieredSto.generateId({
143143
securityTokenId: SecurityToken.generateId({ symbol }),
144-
stoType: StoType.UsdTiered,
144+
stoType: StoType.Tiered,
145145
address: _module,
146146
})
147147
);
148148
}
149149
throw new PolymathError({
150150
code: ErrorCode.UnexpectedEventLogs,
151151
message:
152-
"The USD Tiered STO was successfully launched but the corresponding event wasn't fired. Please report this issue to the Polymath team.",
152+
"The Tiered STO was successfully launched but the corresponding event wasn't fired. Please report this issue to the Polymath team.",
153153
});
154154
},
155155
}
@@ -168,7 +168,7 @@ export class LaunchUsdTieredSto extends Procedure<LaunchUsdTieredStoProcedureArg
168168
fundRaiseTypes: currencies,
169169
wallet: storageWallet,
170170
treasuryWallet,
171-
usdTokens: usdTokenAddresses,
171+
usdTokens: stableCoinAddresses,
172172
},
173173
archived: false,
174174
});

src/procedures/PauseSto.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '../types';
1010
import { PolymathError } from '../PolymathError';
1111
import { isValidAddress } from '../utils';
12-
import { SecurityToken, CappedSto, UsdTieredSto } from '../entities';
12+
import { SecurityToken, CappedSto, TieredSto } from '../entities';
1313

1414
export class PauseSto extends Procedure<PauseStoProcedureArgs> {
1515
public type = ProcedureType.PauseSto;
@@ -39,7 +39,7 @@ export class PauseSto extends Procedure<PauseStoProcedureArgs> {
3939
});
4040
break;
4141
}
42-
case StoType.UsdTiered: {
42+
case StoType.Tiered: {
4343
stoModule = await contractWrappers.moduleFactory.getModuleInstance({
4444
name: ModuleName.UsdTieredSTO,
4545
address: stoAddress,
@@ -80,11 +80,11 @@ export class PauseSto extends Procedure<PauseStoProcedureArgs> {
8080
})
8181
);
8282
}
83-
case StoType.UsdTiered: {
84-
return factories.usdTieredStoFactory.refresh(
85-
UsdTieredSto.generateId({
83+
case StoType.Tiered: {
84+
return factories.tieredStoFactory.refresh(
85+
TieredSto.generateId({
8686
securityTokenId,
87-
stoType: StoType.UsdTiered,
87+
stoType: StoType.Tiered,
8888
address: stoAddress,
8989
})
9090
);

src/procedures/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export { ControllerTransfer } from './ControllerTransfer';
1818
export { PauseSto } from './PauseSto';
1919
export { SetController } from './SetController';
2020
export { LaunchCappedSto } from './LaunchCappedSto';
21-
export { LaunchUsdTieredSto } from './LaunchUsdTieredSto';
21+
export { LaunchTieredSto } from './LaunchTieredSto';
2222
export { ModifyShareholderData } from './ModifyShareholderData';
2323
export { RevokeKyc } from './RevokeKyc';
2424
export { MintTokens } from './MintTokens';

0 commit comments

Comments
 (0)