/// /// import { Address } from '../common/address'; import { Uint256 } from '../common/uint256'; import { LedgerStore } from '../core/ledgerStore'; import { StateStore } from '../core/state/stateStore'; import { Transaction } from '../core/transaction'; import { LogCallback, LogEventInfo, NotificationCallback, NotifyEventInfo } from '../event/notifyEvents'; import { Context, ContextRef, VmService } from './context'; export interface SmartContractConfig { store?: LedgerStore; stateStore?: StateStore; time: number; tx: Transaction; randomHash?: Uint256; gas: Long; enableSecurity?: boolean; enableGas?: boolean; notificationCallback?: NotificationCallback; logCallback?: LogCallback; } export declare class SmartContract implements ContextRef { private contexts; private stateStore; private store; private time; private randomHash; private tx; private notifications; private logs; private gas; private execStep; private notificationCallback?; private logCallback?; private enableSecurity; private enableGas; constructor(config: SmartContractConfig); getNotifications(): NotifyEventInfo[]; getLogs(): LogEventInfo[]; pushContext(context: Context): void; /** * CurrentContext return smart contract current context */ currentContext(): Context; /** * CallingContext return smart contract caller context */ callingContext(): Context | undefined; entryContext(): Context | undefined; popContext(): void; pushNotifications(notifications: NotifyEventInfo[]): void; pushLogs(logs: LogEventInfo[]): void; checkExecStep(): boolean; checkUseGas(gas: Long): boolean; checkContexts(): boolean; /** * Execute is smart contract execute manager * According different vm type to launch different service * @param code */ newExecuteEngine(code: Buffer): VmService; /** * CheckWitness check whether authorization correct * If address is wallet address, check whether in the signature addressed list * Else check whether address is calling contract address * Param address: wallet address or contract address * @param this * @param * @param SmartContract */ checkWitness(address: Address): boolean; checkAccountAddress(address: Address): boolean; checkContractAddress(address: Address): boolean; }