Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 263ecf0

Browse files
committed
feat: 🎸 General Transfer Manager 3.0
1 parent ecb7947 commit 263ecf0

File tree

5 files changed

+357
-58
lines changed

5 files changed

+357
-58
lines changed

‎src/contract_wrappers/modules/checkpoint/dividend_checkpoint_wrapper.ts‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ interface ChangeWalletParams extends TxParams {
4040
wallet: string;
4141
}
4242

43-
interface ReclaimERC20Params extends TxParams {
44-
tokenContract: string;
45-
}
46-
4743
interface SetDefaultExcludedParams extends TxParams {
4844
excluded: string[];
4945
}
@@ -214,22 +210,6 @@ export default abstract class DividendCheckpointWrapper extends ModuleWrapper {
214210
return (await this.contract).unpause.sendTransactionAsync(params.txData, params.safetyFactor);
215211
};
216212

217-
public reclaimERC20 = async (params: ReclaimERC20Params) => {
218-
assert.isNonZeroETHAddressHex('tokenContract', params.tokenContract);
219-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
220-
// require(token.transfer(msg.sender, balance), "Transfer failed");
221-
return (await this.contract).reclaimERC20.sendTransactionAsync(
222-
params.tokenContract,
223-
params.txData,
224-
params.safetyFactor,
225-
);
226-
};
227-
228-
public reclaimETH = async (params: TxParams) => {
229-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
230-
return (await this.contract).reclaimETH.sendTransactionAsync(params.txData, params.safetyFactor);
231-
};
232-
233213
public changeWallet = async (params: ChangeWalletParams) => {
234214
assert.isNonZeroETHAddressHex('wallet', params.wallet);
235215
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');

‎src/contract_wrappers/modules/module_wrapper.ts‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Module } from '@polymathnetwork/contract-artifacts';
22
import { Web3Wrapper } from '@0x/web3-wrapper';
33
import { ContractAbi, TxData } from 'ethereum-types';
4-
import { BigNumber } from '@0x/utils';
54
import {
65
ISecurityTokenContract,
76
ModuleFactoryContract,
@@ -15,8 +14,8 @@ import { stringToBytes32 } from '../../utils/convert';
1514
import functionsUtils from '../../utils/functions_utils';
1615
import assert from '../../utils/assert';
1716

18-
interface TakeFeeParams extends TxParams {
19-
amount: BigNumber;
17+
interface ReclaimERC20Params extends TxParams {
18+
tokenContract: string;
2019
}
2120

2221
/**
@@ -86,6 +85,21 @@ export default class ModuleWrapper extends ContractWrapper {
8685
return (await this.contract).factory.callAsync();
8786
};
8887

88+
public reclaimETH = async (params: TxParams) => {
89+
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
90+
return (await this.contract).reclaimETH.sendTransactionAsync(params.txData, params.safetyFactor);
91+
};
92+
93+
public reclaimERC20 = async (params: ReclaimERC20Params) => {
94+
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
95+
assert.isNonZeroETHAddressHex('tokenContract', params.tokenContract);
96+
return (await this.contract).reclaimERC20.sendTransactionAsync(
97+
params.tokenContract,
98+
params.txData,
99+
params.safetyFactor,
100+
);
101+
};
102+
89103
protected isCallerTheSecurityTokenOwner = async (txData: Partial<TxData> | undefined): Promise<boolean> => {
90104
const from = await this.getCallerAddress(txData);
91105
return functionsUtils.checksumAddressComparision(

‎src/contract_wrappers/modules/sto/sto_wrapper.ts‎

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {TxParams, STOBaseContract, FundRaiseType, FULL_DECIMALS} from '../../../types';
1+
import { TxParams, STOBaseContract, FundRaiseType, FULL_DECIMALS } from '../../../types';
22
import ModuleWrapper from '../module_wrapper';
33
import assert from '../../../utils/assert';
44
import { weiToValue } from '../../../utils/convert';
@@ -7,10 +7,6 @@ interface FundRaiseTypesParams {
77
type: FundRaiseType;
88
}
99

10-
interface ReclaimERC20Params extends TxParams {
11-
tokenContract: string;
12-
}
13-
1410
/**
1511
* This class includes the functionality related to interacting with the all STOs contracts.
1612
*/
@@ -36,10 +32,7 @@ export default abstract class STOWrapper extends ModuleWrapper {
3632
* Returns funds raised by the STO
3733
*/
3834
public fundsRaised = async (params: FundRaiseTypesParams) => {
39-
return weiToValue(
40-
await (await this.contract).fundsRaised.callAsync(params.type),
41-
FULL_DECIMALS,
42-
);
35+
return weiToValue(await (await this.contract).fundsRaised.callAsync(params.type), FULL_DECIMALS);
4336
};
4437

4538
/**
@@ -79,16 +72,13 @@ export default abstract class STOWrapper extends ModuleWrapper {
7972
*/
8073
public totalTokensSold = async () => {
8174
return weiToValue(
82-
await (await this.contract).totalTokensSold.callAsync(),
83-
await (await this.securityTokenContract()).decimals.callAsync(),
75+
await (await this.contract).totalTokensSold.callAsync(),
76+
await (await this.securityTokenContract()).decimals.callAsync(),
8477
);
8578
};
8679

8780
public getRaised = async (params: FundRaiseTypesParams) => {
88-
return weiToValue(
89-
await (await this.contract).getRaised.callAsync(params.type),
90-
FULL_DECIMALS,
91-
);
81+
return weiToValue(await (await this.contract).getRaised.callAsync(params.type), FULL_DECIMALS);
9282
};
9383

9484
public pause = async (params: TxParams) => {
@@ -102,19 +92,4 @@ export default abstract class STOWrapper extends ModuleWrapper {
10292
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
10393
return (await this.contract).unpause.sendTransactionAsync(params.txData, params.safetyFactor);
10494
};
105-
106-
public reclaimERC20 = async (params: ReclaimERC20Params) => {
107-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
108-
assert.isNonZeroETHAddressHex('tokenContract', params.tokenContract);
109-
return (await this.contract).reclaimERC20.sendTransactionAsync(
110-
params.tokenContract,
111-
params.txData,
112-
params.safetyFactor,
113-
);
114-
};
115-
116-
public reclaimETH = async (params: TxParams) => {
117-
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
118-
return (await this.contract).reclaimETH.sendTransactionAsync(params.txData, params.safetyFactor);
119-
};
12095
}

0 commit comments

Comments
 (0)