Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ jobs:
node_js: lts/*
script:
- yarn run build:ci
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then yarn coveralls; fi'
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then yarn jest; fi'
- yarn coveralls
- npm run semantic-release
Binary file added Polymath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[![Build Status](https://travis-ci.org/PolymathNetwork/polymath-contract-wrappers.svg?branch=master)](https://travis-ci.org/PolymathNetwork/contract-wrappers)
[![Coverage Status](https://coveralls.io/repos/github/PolymathNetwork/polymath-contract-wrappers/badge.svg?branch=master)](https://coveralls.io/github/PolymathNetwork/polymath-contract-wrappers?branch=master)
[![Gitter](https://img.shields.io/badge/chat-gitter-green.svg)](https://gitter.im/PolymathNetwork/Lobby)
[![Telegram](https://img.shields.io/badge/50k+-telegram-blue.svg)](https://gitter.im/PolymathNetwork/Lobby)

![Polymath logo](Polymath.png)

## @polymathnetwork/contract-wrappers

Version 3.0.0 of the Polymath-Core Ethereum Smart Contracts
Expand Down Expand Up @@ -27,6 +34,7 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
```

## Documentation

This project uses typedoc documentation style.

You can access these docs by cloning this repo and opening `docs/index.html` in the browser.
Expand All @@ -39,14 +47,14 @@ Commits should follow the [conventional commits](https://www.conventionalcommits

### A note on breaking changes

*Anything* that forcefully changes the way the client interacts with the package is considered a breaking change and should be described in the `BREAKING CHANGE` section of the corresponding commit. This includes (but is not limited to):
_Anything_ that forcefully changes the way the client interacts with the package is considered a breaking change and should be described in the `BREAKING CHANGE` section of the corresponding commit. This includes (but is not limited to):

- Renaming a public function/class/interface/type
- Deleting a public function/class/interface/type
- Changing a public function's argument list in a way that the user needs to rewrite existing calls to it
- Changing a public function's return type

Whatever is written under `BREAKING CHANGES` is literally what will go into the changelog, so please be clear on the messages. For example, if I change the return type of a function called `foo` in class `Bar`, the `BREAKING CHANGE` section of my commit should say something like
Whatever is written under `BREAKING CHANGES` is literally what will go into the changelog, so please be clear on the messages. For example, if I change the return type of a function called `foo` in class `Bar`, the `BREAKING CHANGE` section of my commit should say something like

```
change return type of the `Bar` class's `foo` function from `string` to `number`
Expand Down Expand Up @@ -102,7 +110,7 @@ yarn jest

## Deployment

This package has automatic publishing and versioning via [semantic-release](https://github.com/semantic-release/semantic-release) and forceful use of [conventional commits](https://www.conventionalcommits.org)
This package has automatic publishing and versioning via [semantic-release](https://github.com/semantic-release/semantic-release) and forceful use of [conventional commits](https://www.conventionalcommits.org)

## Sandbox

Expand Down Expand Up @@ -153,7 +161,8 @@ async function getInjectedProviderIfExists(): Promise<Provider> {
return injectedProviderIfExists;
}
```
*Setting up Polymath API for 4 different cases*

_Setting up Polymath API for 4 different cases_

(1) Using Injected Provider (Metamask) to read from the blockchain and publish transactions on the blockchain.

Expand Down Expand Up @@ -222,10 +231,11 @@ const polymathAPI = new PolymathAPI(params);
```

### Module code examples

In the `/examples` directory there are several examples to help developers understand how to use the API within the sandbox.

These examples demonstrate the use of the project's PolymathAPI to get data and publish transactions with Polymath's smart contracts. Register a ticker, generate a new security token and then you can add a module.

When a security token has a module successfully attached, the examples demonstrate how one can work with sto creation, transfer restrictions, permissioning, and directly with the security token.
When a security token has a module successfully attached, the examples demonstrate how one can work with sto creation, transfer restrictions, permissioning, and directly with the security token.

The sandbox code included in the examples demonstrates how to subscribe to events fired from the smart contracts. It also demonstrates how to better catch issues when they happen, during token transfers for instance.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@ import {

const EXCLUDED_ADDRESS_LIMIT = 150;

export namespace DividendCheckpointTransactionParams {
export interface ChangeWallet extends ChangeWalletParams {}
export interface SetDefaultExcluded extends SetDefaultExcludedParams {}
export interface SetWithholding extends SetWithholdingParams {}
export interface SetWithholdingFixed extends SetWithholdingFixedParams {}
export interface PushDividendPaymentToAddresses extends PushDividendPaymentToAddressesParams {}
export interface PushDividendPayment extends PushDividendPaymentParams {}
export interface PullDividendPayment extends DividendIndexTxParams {}
export interface ReclaimDividend extends DividendIndexTxParams {}
export interface WithdrawWithholding extends DividendIndexTxParams {}
export interface UpdateDividendDates extends UpdateDividendDatesParams {}
}

/**
* @param dividendIndex Index of the dividend
*/
Expand Down Expand Up @@ -69,22 +56,22 @@ interface InvestorStatus {
/**
* @param wallet Ethereum account address to receive reclaimed dividends and tax
*/
interface ChangeWalletParams extends TxParams {
export interface ChangeWalletParams extends TxParams {
wallet: string;
}

/**
* @param excluded Addresses of investors
*/
interface SetDefaultExcludedParams extends TxParams {
export interface SetDefaultExcludedParams extends TxParams {
excluded: string[];
}

/**
* @param investors Addresses of investors
* @param withholding Withholding tax array for individual investors
*/
interface SetWithholdingParams extends TxParams {
export interface SetWithholdingParams extends TxParams {
investors: string[];
withholding: BigNumber[];
}
Expand All @@ -93,7 +80,7 @@ interface SetWithholdingParams extends TxParams {
* @param investors Addresses of investor
* @param withholding Single withholding tax for all investors
*/
interface SetWithholdingFixedParams extends TxParams {
export interface SetWithholdingFixedParams extends TxParams {
investors: string[];
withholding: BigNumber;
}
Expand All @@ -102,7 +89,7 @@ interface SetWithholdingFixedParams extends TxParams {
* @param dividendIndex Dividend index to push
* @param payees Addresses to which to push the dividend
*/
interface PushDividendPaymentToAddressesParams extends TxParams {
export interface PushDividendPaymentToAddressesParams extends TxParams {
dividendIndex: number;
payees: string[];
}
Expand All @@ -112,7 +99,7 @@ interface PushDividendPaymentToAddressesParams extends TxParams {
* @param start Index in investor list at which to start pushing dividends
* @param end Index in investor list at which to stop pushing dividends
*/
interface PushDividendPaymentParams extends TxParams {
export interface PushDividendPaymentParams extends TxParams {
dividendIndex: number;
start: number;
end: number;
Expand All @@ -121,7 +108,7 @@ interface PushDividendPaymentParams extends TxParams {
/**
* @param dividendIndex Dividend index to use
*/
interface DividendIndexTxParams extends TxParams {
export interface DividendIndexTxParams extends TxParams {
dividendIndex: number;
}

Expand All @@ -130,7 +117,7 @@ interface DividendIndexTxParams extends TxParams {
* @param maturity Updated maturity date
* @param expiry Updated expiry date
*/
interface UpdateDividendDatesParams extends TxParams {
export interface UpdateDividendDatesParams extends TxParams {
dividendIndex: number;
maturity: Date;
expiry: Date;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
import {
ChangeWalletParams,
SetDefaultExcludedParams,
SetWithholdingParams,
SetWithholdingFixedParams,
PushDividendPaymentToAddressesParams,
PushDividendPaymentParams,
DividendIndexTxParams,
UpdateDividendDatesParams,
} from './common';

/* istanbul ignore file */
export { WithDividendCheckpoint_3_0_0 } from './3.0.0';
export { default as DividendCheckpointCommon } from './common';
export { default as DividendCheckpointCommon } from './common';

export namespace DividendCheckpointTransactionParams {
export interface ChangeWallet extends ChangeWalletParams {}
export interface SetDefaultExcluded extends SetDefaultExcludedParams {}
export interface SetWithholding extends SetWithholdingParams {}
export interface SetWithholdingFixed extends SetWithholdingFixedParams {}
export interface PushDividendPaymentToAddresses extends PushDividendPaymentToAddressesParams {}
export interface PushDividendPayment extends PushDividendPaymentParams {}
export interface PullDividendPayment extends DividendIndexTxParams {}
export interface ReclaimDividend extends DividendIndexTxParams {}
export interface WithdrawWithholding extends DividendIndexTxParams {}
export interface UpdateDividendDates extends UpdateDividendDatesParams {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ import {
import { numberToBigNumber, dateToBigNumber, stringToBytes32, valueToWei } from '../../../../utils/convert';
import ContractWrapper from '../../../contract_wrapper';

export namespace ERC20DividendCheckpointTransactionParams {
export interface CreateDividend extends CreateDividendParams {}
export interface CreateDividendWithCheckpoint extends CreateDividendWithCheckpointParams {}
export interface CreateDividendWithExclusions extends CreateDividendWithExclusionsParams {}
export interface CreateDividendWithCheckpointAndExclusions extends CreateDividendWithCheckpointAndExclusionsParams {}
}

interface ERC20DividendDepositedSubscribeAsyncParams extends SubscribeAsyncParams {
eventName: ERC20DividendCheckpointEvents_3_0_0.ERC20DividendDeposited;
callback: EventCallback<ERC20DividendCheckpointERC20DividendDepositedEventArgs_3_0_0>;
Expand Down Expand Up @@ -200,7 +193,7 @@ interface DividendIndexParams {
* @param amount Amount of specified token for dividend
* @param name Name/Title for identification
*/
interface CreateDividendParams extends TxParams {
export interface CreateDividendParams extends TxParams {
maturity: Date;
expiry: Date;
token: string;
Expand All @@ -211,22 +204,22 @@ interface CreateDividendParams extends TxParams {
/**
* @param checkpointId Checkpoint id from which to create dividends
*/
interface CreateDividendWithCheckpointParams extends CreateDividendParams {
export interface CreateDividendWithCheckpointParams extends CreateDividendParams {
checkpointId: number;
}

/**
* @param excluded List of addresses to exclude
*/
interface CreateDividendWithExclusionsParams extends CreateDividendParams {
export interface CreateDividendWithExclusionsParams extends CreateDividendParams {
excluded: string[];
}

/**
* @param checkpointId Checkpoint id from which to create dividends
* @param excluded List of addresses to exclude
*/
interface CreateDividendWithCheckpointAndExclusionsParams extends CreateDividendParams {
export interface CreateDividendWithCheckpointAndExclusionsParams extends CreateDividendParams {
checkpointId: number;
excluded: string[];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* istanbul ignore file */
import { ERC20DividendCheckpointEventArgs_3_0_0 } from '@polymathnetwork/abi-wrappers';
import { ERC20DividendCheckpoint_3_0_0, isERC20DividendCheckpoint_3_0_0 } from './3.0.0';

import Common, { isERC20DividendCheckpoint } from './common';
import Common, {
isERC20DividendCheckpoint,
CreateDividendParams,
CreateDividendWithCheckpointParams,
CreateDividendWithExclusionsParams,
CreateDividendWithCheckpointAndExclusionsParams,
} from './common';
import { ContractVersion } from '../../../../types';

export type ERC20DividendCheckpointEventArgs = ERC20DividendCheckpointEventArgs_3_0_0;
Expand All @@ -26,6 +31,13 @@ export type ERC20DividendCheckpoint = ERC20DividendCheckpoint_3_0_0;

export { isERC20DividendCheckpoint, ERC20DividendCheckpoint_3_0_0, isERC20DividendCheckpoint_3_0_0 };

export namespace ERC20DividendCheckpointTransactionParams {
export interface CreateDividend extends CreateDividendParams {}
export interface CreateDividendWithCheckpoint extends CreateDividendWithCheckpointParams {}
export interface CreateDividendWithExclusions extends CreateDividendWithExclusionsParams {}
export interface CreateDividendWithCheckpointAndExclusions extends CreateDividendWithCheckpointAndExclusionsParams {}
}

// for internal use
export class ERC20DividendCheckpointCommon extends Common {
public contractVersion!: ContractVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ import {
import { numberToBigNumber, dateToBigNumber, stringToBytes32, valueToWei } from '../../../../utils/convert';
import ContractWrapper from '../../../contract_wrapper';

export namespace EtherDividendCheckpointTransactionParams {
export interface CreateDividend extends CreateDividendParams {}
export interface CreateDividendWithCheckpoint extends CreateDividendWithCheckpointParams {}
export interface CreateDividendWithExclusions extends CreateDividendWithExclusionsParams {}
export interface CreateDividendWithCheckpointAndExclusions extends CreateDividendWithCheckpointAndExclusionsParams {}
}

interface EtherDividendDepositedSubscribeAsyncParams extends SubscribeAsyncParams {
eventName: EtherDividendCheckpointEvents_3_0_0.EtherDividendDeposited;
callback: EventCallback<EtherDividendCheckpointEtherDividendDepositedEventArgs_3_0_0>;
Expand Down Expand Up @@ -206,7 +199,7 @@ export interface GetEtherDividendCheckpointLogsAsyncParams extends GetLogs {
* @param name Name/title for identification
* @param value Value of ether to contribute towards dividend
*/
interface CreateDividendParams extends TxParams {
export interface CreateDividendParams extends TxParams {
maturity: Date;
expiry: Date;
name: string;
Expand All @@ -216,21 +209,21 @@ interface CreateDividendParams extends TxParams {
/**
* @param checkpointId The identifier for the checkpoint
*/
interface CreateDividendWithCheckpointParams extends CreateDividendParams {
export interface CreateDividendWithCheckpointParams extends CreateDividendParams {
checkpointId: number;
}

/**
* @param checkpointId The identifier for the checkpoint
*/
interface CreateDividendWithExclusionsParams extends CreateDividendParams {
export interface CreateDividendWithExclusionsParams extends CreateDividendParams {
excluded: string[];
}

/**
* @param checkpointId The identifier for the checkpoint
*/
interface CreateDividendWithCheckpointAndExclusionsParams extends CreateDividendWithExclusionsParams {
export interface CreateDividendWithCheckpointAndExclusionsParams extends CreateDividendWithExclusionsParams {
checkpointId: number;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
/* istanbul ignore file */
import { EtherDividendCheckpointEventArgs_3_0_0 } from '@polymathnetwork/abi-wrappers';
import { EtherDividendCheckpoint_3_0_0, isEtherDividendCheckpoint_3_0_0 } from './3.0.0';

import Common, { isEtherDividendCheckpoint } from './common';
import Common, {
isEtherDividendCheckpoint,
CreateDividendParams,
CreateDividendWithCheckpointParams,
CreateDividendWithExclusionsParams,
CreateDividendWithCheckpointAndExclusionsParams,
} from './common';
import { ContractVersion } from '../../../../types';

export type EtherDividendCheckpointEventArgs = EtherDividendCheckpointEventArgs_3_0_0;
Expand All @@ -26,6 +31,13 @@ export type EtherDividendCheckpoint = EtherDividendCheckpoint_3_0_0;

export { isEtherDividendCheckpoint, EtherDividendCheckpoint_3_0_0, isEtherDividendCheckpoint_3_0_0 };

export namespace EtherDividendCheckpointTransactionParams {
export interface CreateDividend extends CreateDividendParams {}
export interface CreateDividendWithCheckpoint extends CreateDividendWithCheckpointParams {}
export interface CreateDividendWithExclusions extends CreateDividendWithExclusionsParams {}
export interface CreateDividendWithCheckpointAndExclusions extends CreateDividendWithCheckpointAndExclusionsParams {}
}

// for internal use
export class EtherDividendCheckpointCommon extends Common {
public contractVersion!: ContractVersion;
Expand Down
Loading