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

Commit 5062cc6

Browse files
committed
feat: 🎸 All logs are decoded on every transaction receipt
All logs are decoded, even if they were emitted by another contract
1 parent df211e7 commit 5062cc6

File tree

2 files changed

+220
-57
lines changed

2 files changed

+220
-57
lines changed

‎src/PolymathAPI.ts‎

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import {
55
providerUtils,
66
Provider,
77
PolymathRegistry,
8-
SecurityToken,
9-
SecurityTokenRegistry,
8+
ISecurityTokenRegistry,
9+
ISecurityToken,
1010
PolyToken,
1111
ModuleRegistry,
1212
CappedSTO,
13-
CappedSTOFactory,
1413
ModuleFactory,
1514
USDTieredSTO,
16-
USDTieredSTOFactory,
1715
FeatureRegistry,
1816
GeneralTransferManager,
1917
GeneralPermissionManager,
@@ -23,7 +21,10 @@ import {
2321
PercentageTransferManager,
2422
EtherDividendCheckpoint,
2523
VolumeRestrictionTransferManager,
26-
PolyTokenFaucet, } from '@polymathnetwork/abi-wrappers';
24+
PolyTokenFaucet,
25+
Module,
26+
ERC20Detailed,
27+
} from '@polymathnetwork/abi-wrappers';
2728
import PolymathRegistryWrapper from './contract_wrappers/registries/polymath_registry_wrapper';
2829
import SecurityTokenRegistryWrapper from './contract_wrappers/registries/security_token_registry_wrapper';
2930
import PolyTokenWrapper from './contract_wrappers/tokens/poly_token_wrapper';
@@ -132,36 +133,55 @@ export class PolymathAPI {
132133
gasPrice: params.defaultGasPrice,
133134
});
134135

135-
const artifactsArray = [
136-
PolymathRegistry,
137-
SecurityToken,
138-
SecurityTokenRegistry,
139-
PolyToken,
140-
ModuleRegistry,
141-
CappedSTO,
142-
CappedSTOFactory,
143-
ModuleFactory,
144-
USDTieredSTO,
145-
USDTieredSTOFactory,
146-
FeatureRegistry,
147-
GeneralTransferManager,
148-
GeneralPermissionManager,
149-
ERC20DividendCheckpoint,
150-
ManualApprovalTransferManager,
151-
CountTransferManager,
152-
PercentageTransferManager,
153-
EtherDividendCheckpoint,
154-
VolumeRestrictionTransferManager,
155-
PolyTokenFaucet,
136+
const abiArray = [
137+
// Registries
138+
FeatureRegistry.abi,
139+
ModuleRegistry.abi,
140+
PolymathRegistry.abi,
141+
ISecurityTokenRegistry.abi.filter(
142+
a =>
143+
a.type !== 'event' &&
144+
a.name !== 'RegisterTicker' &&
145+
a.inputs ===
146+
[
147+
{ indexed: true, name: '_owner', type: 'address' },
148+
{ indexed: false, name: '_ticker', type: 'string' },
149+
{ indexed: false, name: '_name', type: 'string' },
150+
{ indexed: true, name: '_registrationDate', type: 'uint256' },
151+
{ indexed: true, name: '_expiryDate', type: 'uint256' },
152+
{ indexed: false, name: '_fromAdmin', type: 'bool' },
153+
{ indexed: false, name: '_registrationFee', type: 'uint256' },
154+
],
155+
),
156+
// Modules
157+
ModuleFactory.abi,
158+
Module.abi,
159+
// Checkpoint
160+
ERC20DividendCheckpoint.abi,
161+
EtherDividendCheckpoint.abi,
162+
// Permission
163+
GeneralPermissionManager.abi,
164+
// STO
165+
CappedSTO.abi,
166+
USDTieredSTO.abi,
167+
// Transfer
168+
CountTransferManager.abi,
169+
GeneralTransferManager.abi,
170+
ManualApprovalTransferManager.abi,
171+
PercentageTransferManager.abi,
172+
VolumeRestrictionTransferManager.abi,
173+
// Tokens
174+
ERC20Detailed.abi,
175+
PolyToken.abi,
176+
PolyTokenFaucet.abi,
177+
ISecurityToken.abi,
156178
];
157179

158-
artifactsArray.forEach(
159-
(artifact): void => {
160-
this.web3Wrapper.abiDecoder.addABI(artifact.abi);
161-
},
162-
);
180+
abiArray.forEach((abi): void => {
181+
this.web3Wrapper.abiDecoder.addABI(abi);
182+
});
163183

164-
this.contractFactory = new ContractFactory(this.web3Wrapper, params.polymathRegistryAddress);
184+
this.contractFactory = new ContractFactory(this.web3Wrapper, abiArray, params.polymathRegistryAddress);
165185

166186
this.polymathRegistry = new PolymathRegistryWrapper(
167187
this.web3Wrapper,
@@ -217,7 +237,7 @@ export class PolymathAPI {
217237
*/
218238
public getERC20TokenWrapper = async (params: GetERC20WrapperParams): Promise<ERC20> => {
219239
return this.tokenFactory.getERC20TokenInstanceFromAddress(params.address);
220-
}
240+
};
221241

222242
/**
223243
* Get the account currently used by PolymathAPI

0 commit comments

Comments
 (0)