@melonproject/protocol
Version:
Technology Regulated and Operated Investment Funds
84 lines (83 loc) • 2.71 kB
TypeScript
import * as Eth from 'web3-eth';
import { Address } from '@melonproject/token-math';
import { UnsignedRawTransaction } from '../solidity/transactionFactory';
import { MelonContracts, MelonContractsDraft } from '../deploy/deploySystem';
import { ThirdPartyContracts } from '../deploy/deployThirdParty';
import { ExchangeConfigs } from '../../contracts/factory/transactions/beginSetup';
export interface Web3Signature {
message: string;
messageHash: string;
v: string;
r: string;
s: string;
signature: string;
}
export declare type SignTransactionFunction = (unsignedTransaction: UnsignedRawTransaction, from?: Address) => Promise<string>;
export declare type SignMessageFunction = (message: string, from?: Address) => Promise<Web3Signature>;
export declare enum Tracks {
TESTING = "testing",
KYBER_PRICE = "kyberPrice"
}
export declare enum LogLevels {
ERROR = "error",
WARN = "warn",
INFO = "info",
DEBUG = "debug"
}
export declare type LoggerFunction = (...messages: any) => void;
export declare type LoggerFunctionWithLevel = {
(level: LogLevels): LoggerFunction;
(level: LogLevels, message: any, ...messages: any): void;
};
export declare type CurriedLogger = {
(namespace: string, level: LogLevels, message: any, ...messages: any): void;
(namespace: string, level: LogLevels): LoggerFunction;
(namespace: string): LoggerFunctionWithLevel;
};
export interface Wallet {
address: Address;
signTransaction?: SignTransactionFunction;
signMessage?: SignMessageFunction;
}
export interface Options {
readonly gasLimit: string;
readonly gasPrice: string;
}
export interface DeployMeta {
deployer: Address;
timestamp: string;
track: Tracks;
version: string;
chain: number;
description?: string;
}
export interface Deployment {
meta: DeployMeta;
exchangeConfigs: ExchangeConfigs;
melonContracts: MelonContracts;
thirdPartyContracts: ThirdPartyContracts;
}
export interface PartialDeployment {
meta?: DeployMeta;
exchangeConfigs?: ExchangeConfigs;
thirdPartyContracts?: Partial<ThirdPartyContracts>;
melonContracts?: MelonContractsDraft;
}
export interface Environment {
readonly eth: Eth;
readonly track: Tracks;
readonly wallet?: Wallet;
readonly options: Options;
readonly logger: CurriedLogger;
readonly deployment?: PartialDeployment;
}
export interface WithDeployment extends Environment {
readonly deployment: Deployment;
}
export interface WithWallet extends Environment {
readonly wallet: Wallet;
}
export interface WithWalletAndDeployment extends Environment {
readonly deployment: Deployment;
readonly wallet: Wallet;
}