Skip to content

Commit b2152ef

Browse files
author
Victor Wiebe
committed
fix: address review comments across controller and freezeIssuance
1 parent a045d00 commit b2152ef

6 files changed

Lines changed: 26 additions & 17 deletions

File tree

src/entities/SecurityToken/Controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export class Controller extends SubModule {
2020
};
2121

2222
/**
23-
* Used by the issuer to permanently disable controller functionality
24-
* Signature is optional, and will be generated if it is not passed in
23+
* Permanently disable controller functionality
24+
* @param signature optional signed data. If not passed, signing will be requested on the spot
2525
*/
2626
public disableController = async (args?: { signature?: string }) => {
2727
const { symbol } = this.securityToken;

src/entities/SecurityToken/Shareholders.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ export class Shareholders extends SubModule {
225225
};
226226

227227
/**
228-
* Used by the issuer to permanently freeze issuance of the security token
229-
* Signature is optional, and will be generated if it is not passed in
228+
* Permanently freeze issuance of the security token
229+
* @param signature optional signed data. If not passed, signing will be requested on the spot
230230
*/
231231
public freezeIssuance = async (args?: { signature?: string }) => {
232232
const { symbol } = this.securityToken;

src/procedures/DisableController.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ export class DisableController extends Procedure<DisableControllerProcedureArgs>
2727
});
2828
}
2929

30-
const [owner, account] = await Promise.all([securityToken.owner(), currentWallet.address()]);
30+
const [owner, account, isControllable] = await Promise.all([
31+
securityToken.owner(),
32+
currentWallet.address(),
33+
securityToken.isControllable(),
34+
]);
3135

3236
if (account !== owner) {
3337
throw new PolymathError({
@@ -36,15 +40,16 @@ export class DisableController extends Procedure<DisableControllerProcedureArgs>
3640
});
3741
}
3842

39-
if (!(await securityToken.isControllable())) {
43+
if (!isControllable) {
4044
throw new PolymathError({
4145
code: ErrorCode.ProcedureValidationError,
42-
message: `The security token isControllable method is not currently valid, disable controller method can only be called on controllable security tokens`,
46+
message: `The controller has already been disabled permanently`,
4347
});
4448
}
4549

4650
// If there is no hex signature passed in, create a signature request to sign the disable controller acknowledgement
47-
const requestedSignature = signature || await this.addSignatureRequest(securityToken.signDisableControllerAck)({});
51+
const requestedSignature =
52+
signature || (await this.addSignatureRequest(securityToken.signDisableControllerAck)({}));
4853

4954
/**
5055
* Transactions

src/procedures/FreezeIssuance.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,28 @@ export class FreezeIssuance extends Procedure<FreezeIssuanceProcedureArgs> {
2727
});
2828
}
2929

30-
const owner = await securityToken.owner();
31-
const account = await currentWallet.address();
30+
const [owner, account, isIssuable] = await Promise.all([
31+
securityToken.owner(),
32+
currentWallet.address(),
33+
securityToken.isIssuable(),
34+
]);
3235

3336
if (account !== owner) {
3437
throw new PolymathError({
3538
code: ErrorCode.ProcedureValidationError,
36-
message: `You must be the owner of this Security Token to disable the controller`,
39+
message: `You must be the owner of this Security Token to freeze issuance`,
3740
});
3841
}
3942

40-
if (!(await securityToken.isIssuable())) {
43+
if (!isIssuable) {
4144
throw new PolymathError({
4245
code: ErrorCode.ProcedureValidationError,
43-
message: `The security token isIssuable method is not currently valid, freeze issuance method can only be called on issuable security tokens`,
46+
message: `The issuance has already been frozen permanently`,
4447
});
4548
}
4649
// If there is no hex signature passed in, create a signature request to sign the freeze issuance acknowledgement
47-
const requestedSignature = signature || await this.addSignatureRequest(securityToken.signFreezeIssuanceAck)({});
50+
const requestedSignature =
51+
signature || (await this.addSignatureRequest(securityToken.signFreezeIssuanceAck)({}));
4852

4953
/**
5054
* Transactions

src/procedures/__tests__/FreezeIssuance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const params: FreezeIssuanceProcedureArgs = {
2020
};
2121

2222
const ownerAddress = '0x01';
23-
const randomSignature = 'Random disable controller signature ack';
23+
const randomSignature = 'Random freeze issuance signature ack';
2424

2525
describe('FreezeIssuance', () => {
2626
let target: FreezeIssuance;
@@ -97,7 +97,7 @@ describe('FreezeIssuance', () => {
9797
await expect(target.prepareTransactions()).rejects.toThrowError(
9898
new PolymathError({
9999
code: ErrorCode.ProcedureValidationError,
100-
message: `You must be the owner of this Security Token to disable the controller`,
100+
message: `You must be the owner of this Security Token to freeze issuance`,
101101
})
102102
);
103103
});

src/procedures/__tests__/LaunchTieredSto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const params: LaunchTieredStoProcedureArgs = {
4545
currencies: [Currency.StableCoin],
4646
stableCoinAddresses: ['0x7777777777777777777777777777777777777777'],
4747
customOracleAddresses: ['0x8888888888888888888888888888888888888888'],
48-
denominatedCurrency: 'USDT',
48+
denominatedCurrency: 'USD',
4949
};
5050

5151
const currentWallet = '0x8888888888888888888888888888888888888888';

0 commit comments

Comments
 (0)