New logic for makers joining pools
This commit is contained in:
		@@ -150,12 +150,6 @@ export const constants = {
 | 
			
		||||
            { name: 'approvalExpirationTimeSeconds', type: 'uint256' },
 | 
			
		||||
        ],
 | 
			
		||||
    },
 | 
			
		||||
    STAKING_DOMAIN_NAME: '0x Protocol Staking',
 | 
			
		||||
    STAKING_DOMAIN_VERSION: '1.0.0',
 | 
			
		||||
    STAKING_POOL_APPROVAL_SCHEMA: {
 | 
			
		||||
        name: 'StakingPoolApproval',
 | 
			
		||||
        parameters: [{ name: 'poolId', type: 'bytes32' }, { name: 'makerAddress', type: 'address' }],
 | 
			
		||||
    },
 | 
			
		||||
    ERC20_METHOD_ABI,
 | 
			
		||||
    ERC721_METHOD_ABI,
 | 
			
		||||
    MULTI_ASSET_METHOD_ABI,
 | 
			
		||||
 
 | 
			
		||||
@@ -125,34 +125,4 @@ export const eip712Utils = {
 | 
			
		||||
        );
 | 
			
		||||
        return typedData;
 | 
			
		||||
    },
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates an Coordiantor typedData EIP712TypedData object for use with the Coordinator extension contract
 | 
			
		||||
     * @return  A typed data object
 | 
			
		||||
     */
 | 
			
		||||
    createStakingPoolApprovalTypedData: (
 | 
			
		||||
        poolId: string,
 | 
			
		||||
        makerAddress: string,
 | 
			
		||||
        verifyingContractAddress: string,
 | 
			
		||||
        chainId: number,
 | 
			
		||||
    ): EIP712TypedData => {
 | 
			
		||||
        const domain = {
 | 
			
		||||
            name: constants.STAKING_DOMAIN_NAME,
 | 
			
		||||
            version: constants.STAKING_DOMAIN_VERSION,
 | 
			
		||||
            verifyingContractAddress,
 | 
			
		||||
            chainId,
 | 
			
		||||
        };
 | 
			
		||||
        const approval = {
 | 
			
		||||
            poolId,
 | 
			
		||||
            makerAddress,
 | 
			
		||||
        };
 | 
			
		||||
        const typedData = eip712Utils.createTypedData(
 | 
			
		||||
            constants.STAKING_POOL_APPROVAL_SCHEMA.name,
 | 
			
		||||
            {
 | 
			
		||||
                StakingPoolApproval: constants.STAKING_POOL_APPROVAL_SCHEMA.parameters,
 | 
			
		||||
            },
 | 
			
		||||
            approval,
 | 
			
		||||
            domain,
 | 
			
		||||
        );
 | 
			
		||||
        return typedData;
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,13 @@ import { BigNumber, RevertError } from '@0x/utils';
 | 
			
		||||
 | 
			
		||||
// tslint:disable:max-classes-per-file
 | 
			
		||||
 | 
			
		||||
export enum MakerPoolAssignmentErrorCodes {
 | 
			
		||||
    MakerAddressAlreadyRegistered,
 | 
			
		||||
    MakerAddressNotRegistered,
 | 
			
		||||
    MakerAddressNotPendingAdd,
 | 
			
		||||
    PoolIsFull,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class MiscalculatedRewardsError extends RevertError {
 | 
			
		||||
    constructor(totalRewardsPaid?: BigNumber | number | string, initialContractBalance?: BigNumber | number | string) {
 | 
			
		||||
        super(
 | 
			
		||||
@@ -36,42 +43,6 @@ export class ExchangeAddressNotRegisteredError extends RevertError {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SignatureLengthGreaterThan0RequiredError extends RevertError {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        super('SignatureLengthGreaterThan0RequiredError', 'SignatureLengthGreaterThan0RequiredError()', {});
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SignatureUnsupportedError extends RevertError {
 | 
			
		||||
    constructor(signature?: string) {
 | 
			
		||||
        super('SignatureUnsupportedError', 'SignatureUnsupportedError(bytes signature)', { signature });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SignatureIllegalError extends RevertError {
 | 
			
		||||
    constructor(signature?: string) {
 | 
			
		||||
        super('SignatureIllegalError', 'SignatureIllegalError(bytes signature)', { signature });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SignatureLength0RequiredError extends RevertError {
 | 
			
		||||
    constructor(signature?: string) {
 | 
			
		||||
        super('SignatureLength0RequiredError', 'SignatureLength0RequiredError(bytes signature)', { signature });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SignatureLength65RequiredError extends RevertError {
 | 
			
		||||
    constructor(signature?: string) {
 | 
			
		||||
        super('SignatureLength65RequiredError', 'SignatureLength65RequiredError(bytes signature)', { signature });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class WalletError extends RevertError {
 | 
			
		||||
    constructor(walletAddress?: string, errorData?: string) {
 | 
			
		||||
        super('WalletError', 'WalletError(address walletAddress, bytes errorData)', { walletAddress, errorData });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class InsufficientBalanceError extends RevertError {
 | 
			
		||||
    constructor(amount?: BigNumber | number | string, balance?: BigNumber | number | string) {
 | 
			
		||||
        super('InsufficientBalanceError', 'InsufficientBalanceError(uint256 amount, uint256 balance)', {
 | 
			
		||||
@@ -101,30 +72,16 @@ export class OnlyCallableByPoolOperatorOrMakerError extends RevertError {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class InvalidMakerSignatureError extends RevertError {
 | 
			
		||||
    constructor(poolId?: string, makerAddress?: string, makerSignature?: string) {
 | 
			
		||||
export class MakerPoolAssignmentError extends RevertError {
 | 
			
		||||
    constructor(error?: MakerPoolAssignmentErrorCodes, makerAddress?: string, poolId?: string) {
 | 
			
		||||
        super(
 | 
			
		||||
            'InvalidMakerSignatureError',
 | 
			
		||||
            'InvalidMakerSignatureError(bytes32 poolId, address makerAddress, bytes makerSignature)',
 | 
			
		||||
            { poolId, makerAddress, makerSignature },
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class MakerAddressAlreadyRegisteredError extends RevertError {
 | 
			
		||||
    constructor(makerAddress?: string) {
 | 
			
		||||
        super('MakerAddressAlreadyRegisteredError', 'MakerAddressAlreadyRegisteredError(address makerAddress)', {
 | 
			
		||||
            makerAddress,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class MakerAddressNotRegisteredError extends RevertError {
 | 
			
		||||
    constructor(makerAddress?: string, makerPoolId?: string, poolId?: string) {
 | 
			
		||||
        super(
 | 
			
		||||
            'MakerAddressNotRegisteredError',
 | 
			
		||||
            'MakerAddressNotRegisteredError(address makerAddress, bytes32 makerPoolId, bytes32 poolId)',
 | 
			
		||||
            { makerAddress, makerPoolId, poolId },
 | 
			
		||||
            'MakerPoolAssignmentError',
 | 
			
		||||
            'MakerPoolAssignmentError(uint8 error, address makerAddress, bytes32 poolId)',
 | 
			
		||||
            {
 | 
			
		||||
                error,
 | 
			
		||||
                makerAddress,
 | 
			
		||||
                poolId,
 | 
			
		||||
            },
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -143,7 +100,7 @@ export class BlockTimestampTooLowError extends RevertError {
 | 
			
		||||
    constructor(epochEndTime?: BigNumber | number | string, currentBlockTimestamp?: BigNumber | number | string) {
 | 
			
		||||
        super(
 | 
			
		||||
            'BlockTimestampTooLowError',
 | 
			
		||||
            'BlockTimestampTooLowError(uint64 epochEndTime, uint64 currentBlockTimestamp)',
 | 
			
		||||
            'BlockTimestampTooLowError(uint256 epochEndTime, uint256 currentBlockTimestamp)',
 | 
			
		||||
            { epochEndTime, currentBlockTimestamp },
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
@@ -227,18 +184,10 @@ const types = [
 | 
			
		||||
    OnlyCallableByExchangeError,
 | 
			
		||||
    ExchangeAddressAlreadyRegisteredError,
 | 
			
		||||
    ExchangeAddressNotRegisteredError,
 | 
			
		||||
    SignatureLengthGreaterThan0RequiredError,
 | 
			
		||||
    SignatureUnsupportedError,
 | 
			
		||||
    SignatureIllegalError,
 | 
			
		||||
    SignatureLength0RequiredError,
 | 
			
		||||
    SignatureLength65RequiredError,
 | 
			
		||||
    WalletError,
 | 
			
		||||
    InsufficientBalanceError,
 | 
			
		||||
    OnlyCallableByPoolOperatorError,
 | 
			
		||||
    OnlyCallableByPoolOperatorOrMakerError,
 | 
			
		||||
    InvalidMakerSignatureError,
 | 
			
		||||
    MakerAddressAlreadyRegisteredError,
 | 
			
		||||
    MakerAddressNotRegisteredError,
 | 
			
		||||
    MakerPoolAssignmentError,
 | 
			
		||||
    WithdrawAmountExceedsMemberBalanceError,
 | 
			
		||||
    BlockTimestampTooLowError,
 | 
			
		||||
    OnlyCallableByStakingContractError,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user