Refactor contracts-* exports so none in test dir so npmignore works as intended

This commit is contained in:
fabioberger
2019-11-11 21:49:29 +00:00
parent 67e7b5c124
commit 6324a92ec5
64 changed files with 72 additions and 294 deletions

View File

@@ -12,7 +12,7 @@ import {
OperatorShareByPoolId,
RewardBalanceByPoolId,
RewardByPoolId,
} from '../utils/types';
} from '../../src/types';
import { BaseActor } from './base_actor';

View File

@@ -3,7 +3,7 @@ import { BigNumber, RevertError } from '@0x/utils';
import * as _ from 'lodash';
import { StakingApiWrapper } from '../utils/api_wrapper';
import { StakeBalances, StakeInfo, StakeStatus, StoredBalance } from '../utils/types';
import { StakeBalances, StakeInfo, StakeStatus, StoredBalance } from '../../src/types';
import { BaseActor } from './base_actor';

View File

@@ -3,7 +3,7 @@ import { blockchainTests, expect } from '@0x/contracts-test-utils';
import * as _ from 'lodash';
import { deployAndConfigureContractsAsync, StakingApiWrapper } from './utils/api_wrapper';
import { constants as stakingConstants } from './utils/constants';
import { constants as stakingConstants } from '../src/constants';
// tslint:disable:no-unnecessary-type-assertion
blockchainTests('Epochs', env => {

View File

@@ -13,7 +13,7 @@ import {
import { artifacts } from './artifacts';
import { constants as stakingConstants } from './utils/constants';
import { constants as stakingConstants } from '../src/constants';
blockchainTests('Migration tests', env => {
let authorizedAddress: string;

View File

@@ -6,7 +6,7 @@ import * as _ from 'lodash';
import { MakerActor } from './actors/maker_actor';
import { PoolOperatorActor } from './actors/pool_operator_actor';
import { deployAndConfigureContractsAsync, StakingApiWrapper } from './utils/api_wrapper';
import { constants as stakingConstants } from './utils/constants';
import { constants as stakingConstants } from '../src/constants';
// tslint:disable:no-unnecessary-type-assertion
// tslint:disable:max-file-line-count

View File

@@ -13,7 +13,7 @@ import { LogEntry } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { constants as stakingConstants } from '../utils/constants';
import { constants as stakingConstants } from '.../src/constants';
import { assertIntegerRoughlyEquals, getRandomInteger, toBaseUnitAmount } from '../utils/number_utils';
import {

View File

@@ -2,7 +2,7 @@ import { blockchainTests, expect } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { constants as stakingConstants } from '../utils/constants';
import { constants as stakingConstants } from '.../src/constants';
import { toBaseUnitAmount } from '../utils/number_utils';
import { artifacts } from '../artifacts';

View File

@@ -3,7 +3,7 @@ import { StakingRevertErrors } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { LogWithDecodedArgs } from 'ethereum-types';
import { constants as stakingConstants } from '../utils/constants';
import { constants as stakingConstants } from '.../src/constants';
import { artifacts } from '../artifacts';
import {

View File

@@ -2,8 +2,8 @@ import { blockchainTests, expect, Numberish } from '@0x/contracts-test-utils';
import { StakingRevertErrors } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { constants } from '../utils/constants';
import { StoredBalance } from '../utils/types';
import { constants } from '.../src/constants';
import { StoredBalance } from '../../src/types';
import { artifacts } from '../artifacts';
import { TestMixinStakeStorageContract } from '../wrappers';

View File

@@ -14,7 +14,7 @@ import {
import { BigNumber } from '@0x/utils';
import { LogEntry, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { StoredBalance } from '../utils/types';
import { StoredBalance } from '../../src/types';
import { artifacts } from '../artifacts';
import { TestMixinStakingPoolRewardsContract, TestMixinStakingPoolRewardsEvents as Events } from '../wrappers';

View File

@@ -6,8 +6,8 @@ import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { IStakingEventsParamsSetEventArgs, TestMixinParamsContract } from '../wrappers';
import { constants as stakingConstants } from '../utils/constants';
import { StakingParams } from '../utils/types';
import { constants as stakingConstants } from '.../src/constants';
import { StakingParams } from '../../src/types';
blockchainTests('Configurable Parameters unit tests', env => {
let testContract: TestMixinParamsContract;

View File

@@ -11,8 +11,8 @@ import { BigNumber, SafeMathRevertErrors } from '@0x/utils';
import { artifacts } from '../artifacts';
import { TestMixinStakeBalancesContract } from '../wrappers';
import { constants as stakingConstants } from '../utils/constants';
import { StakeStatus, StoredBalance } from '../utils/types';
import { constants as stakingConstants } from '.../src/constants';
import { StakeStatus, StoredBalance } from '../../src/types';
blockchainTests.resets('MixinStakeBalances unit tests', env => {
let testContract: TestMixinStakeBalancesContract;

View File

@@ -13,7 +13,7 @@ import { StakingRevertErrors } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { StakeStatus } from '../utils/types';
import { StakeStatus } from '../../src/types';
import { artifacts } from '../artifacts';
import {

View File

@@ -11,7 +11,7 @@ import {
TestStakingProxyUnitContract,
} from '../wrappers';
import { constants as stakingConstants } from '../utils/constants';
import { constants as stakingConstants } from '.../src/constants';
blockchainTests.resets('StakingProxy unit tests', env => {
const testString = 'Hello, World!';

View File

@@ -13,7 +13,7 @@ import { RevertReason } from '@0x/types';
import { AuthorizableRevertErrors, BigNumber, SafeMathRevertErrors } from '@0x/utils';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { constants as stakingConstants } from '../utils/constants';
import { constants as stakingConstants } from '.../src/constants';
import { artifacts } from '../artifacts';
import {

View File

@@ -1,22 +0,0 @@
import { constants as testConstants } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
const TEN_DAYS = 10 * 24 * 60 * 60;
const PPM = 10 ** 6;
export const constants = {
TOKEN_MULTIPLIER: testConstants.DUMMY_TOKEN_DECIMALS,
INITIAL_POOL_ID: '0x0000000000000000000000000000000000000000000000000000000000000001',
SECOND_POOL_ID: '0x0000000000000000000000000000000000000000000000000000000000000002',
NIL_POOL_ID: '0x0000000000000000000000000000000000000000000000000000000000000000',
NIL_ADDRESS: '0x0000000000000000000000000000000000000000',
INITIAL_EPOCH: new BigNumber(1),
DEFAULT_PARAMS: {
epochDurationInSeconds: new BigNumber(TEN_DAYS),
rewardDelegatedStakeWeight: new BigNumber(PPM * 0.9),
minimumPoolStake: new BigNumber(10).pow(testConstants.DUMMY_TOKEN_DECIMALS).times(100),
cobbDouglasAlphaNumerator: new BigNumber(2),
cobbDouglasAlphaDenominator: new BigNumber(3),
},
PPM,
ONE_DAY_IN_SECONDS: 24 * 60 * 60,
};

View File

@@ -1,130 +0,0 @@
import { Numberish } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types';
import { constants } from './constants';
export interface StakingParams {
epochDurationInSeconds: Numberish;
rewardDelegatedStakeWeight: Numberish;
minimumPoolStake: Numberish;
cobbDouglasAlphaNumerator: Numberish;
cobbDouglasAlphaDenominator: Numberish;
}
export interface StakerBalances {
zrxBalance: BigNumber;
stakeBalance: BigNumber;
stakeBalanceInVault: BigNumber;
activatableStakeBalance: BigNumber;
activatedStakeBalance: BigNumber;
deactivatedStakeBalance: BigNumber;
timeLockedStakeBalance: BigNumber;
}
export interface DelegatorBalances extends StakerBalances {
delegatedStakeBalance: BigNumber;
stakeDelegatedToPoolByOwner: BigNumber[];
stakeDelegatedToPool: BigNumber[];
}
export interface SimulationParams {
users: string[];
numberOfPools: number;
poolOperatorShares: number[];
stakeByPoolOperator: BigNumber[];
numberOfMakers: number;
numberOfMakersPerPool: number[];
protocolFeesByMaker: BigNumber[];
numberOfDelegators: number;
numberOfDelegatorsPerPool: number[];
stakeByDelegator: BigNumber[];
expectedFeesByPool: BigNumber[];
expectedPayoutByPool: BigNumber[];
expectedPayoutByPoolOperator: BigNumber[];
expectedMembersPayoutByPool: BigNumber[];
expectedPayoutByDelegator: BigNumber[];
exchangeAddress: string;
delegateInNextEpoch: boolean;
withdrawByUndelegating: boolean;
}
export interface EndOfEpochInfo {
closingEpoch: BigNumber;
activePoolIds: string[];
rewardsAvailable: BigNumber;
totalFeesCollected: BigNumber;
totalWeightedStake: BigNumber;
}
export interface StoredBalance {
currentEpoch: BigNumber;
currentEpochBalance: BigNumber;
nextEpochBalance: BigNumber;
}
export interface StakeBalanceByPool {
[key: string]: StoredBalance;
}
export enum StakeStatus {
Undelegated,
Delegated,
}
export class StakeInfo {
public status: StakeStatus;
public poolId: string;
constructor(status: StakeStatus, poolId?: string) {
this.status = status;
this.poolId = poolId !== undefined ? poolId : constants.NIL_POOL_ID;
}
}
export interface StakeBalances {
currentEpoch: BigNumber;
zrxBalance: BigNumber;
stakeBalance: BigNumber;
stakeBalanceInVault: BigNumber;
undelegatedStakeBalance: StoredBalance;
delegatedStakeBalance: StoredBalance;
globalUndelegatedStakeBalance: StoredBalance;
globalDelegatedStakeBalance: StoredBalance;
delegatedStakeByPool: StakeBalanceByPool;
totalDelegatedStakeByPool: StakeBalanceByPool;
}
export interface RewardBalanceByPoolId {
[key: string]: BigNumber;
}
export interface OperatorShareByPoolId {
[key: string]: BigNumber;
}
export interface OperatorBalanceByPoolId {
[key: string]: BigNumber;
}
export interface BalanceByOwner {
[key: string]: BigNumber;
}
export interface RewardByPoolId {
[key: string]: BigNumber;
}
export interface DelegatorBalancesByPoolId {
[key: string]: BalanceByOwner;
}
export interface OperatorByPoolId {
[key: string]: string;
}
export interface DelegatorsByPoolId {
[key: string]: string[];
}
export type DecodedLogs = Array<LogWithDecodedArgs<DecodedLogArgs>>;