UNPKG

@lumina-dex/contracts

Version:
1,771 lines (1,762 loc) 87.4 kB
export * from 'mina-fungible-token'; import * as o1js from 'o1js'; import { Field, Bool, UInt32, PublicKey, MerkleMapWitness, Signature, SmartContract, VerificationKey, DeployArgs, TokenContract, State, AccountUpdateForest, UInt64, Types, Int64 } from 'o1js'; import * as o1js_dist_node_lib_provable_field_js from 'o1js/dist/node/lib/provable/field.js'; import * as o1js_dist_node_lib_provable_types_provable_intf_js from 'o1js/dist/node/lib/provable/types/provable-intf.js'; import * as o1js_dist_node_lib_provable_types_provable_intf from 'o1js/dist/node/lib/provable/types/provable-intf'; import * as o1js_dist_node_lib_provable_field from 'o1js/dist/node/lib/provable/field'; import * as o1js_dist_node_lib_provable_merkle_tree from 'o1js/dist/node/lib/provable/merkle-tree'; declare const updateSigner = "UpdateSigner"; declare const updateFactory = "UpdateFactory"; declare const updateDelegator = "UpdateDelegator"; declare const updateProtocol = "UpdateProtocol"; declare const deployPoolRight: o1js_dist_node_lib_provable_field.Field; declare const updateSignerRight: o1js_dist_node_lib_provable_field.Field; declare const updateProtocolRight: o1js_dist_node_lib_provable_field.Field; declare const updateDelegatorRight: o1js_dist_node_lib_provable_field.Field; declare const updateFactoryRight: o1js_dist_node_lib_provable_field.Field; declare const allRight: o1js_dist_node_lib_provable_field.Field; declare function hasRight(userRight: Field, right: Field): Bool; declare const UpdateFactoryInfo_base: (new (value: { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }, { newVkHash: bigint; deadlineSlot: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; } & { fromValue: (value: { newVkHash: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }) => { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; toInput: (x: { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { newVkHash: string; deadlineSlot: string; }; fromJSON: (x: { newVkHash: string; deadlineSlot: string; }) => { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; empty: () => { newVkHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; }; /** * Information needed to update the factory verification key */ declare class UpdateFactoryInfo extends UpdateFactoryInfo_base { constructor(value: { newVkHash: Field; deadlineSlot: UInt32; }); /** * Data use to create the signature * @returns array of field of all parameters */ toFields(): Field[]; hash(): Field; } declare const UpdateAccountInfo_base: (new (value: { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }, { oldUser: { x: bigint; isOdd: boolean; }; newUser: { x: bigint; isOdd: boolean; }; right: bigint; deadlineSlot: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; } & { fromValue: (value: { oldUser: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; newUser: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; right: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }) => { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; toInput: (x: { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { oldUser: string; newUser: string; right: string; deadlineSlot: string; }; fromJSON: (x: { oldUser: string; newUser: string; right: string; deadlineSlot: string; }) => { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; empty: () => { oldUser: PublicKey; newUser: PublicKey; right: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; }; /** * Information needed to update the delegator/protocol */ declare class UpdateAccountInfo extends UpdateAccountInfo_base { constructor(value: { oldUser: PublicKey; newUser: PublicKey; right: Field; deadlineSlot: UInt32; }); /** * Data use to create the signature * @returns array of field of all parameters */ toFields(): Field[]; hash(): Field; } declare const UpdateSignerData_base: (new (value: { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }, { oldRoot: bigint; newRoot: bigint; deadlineSlot: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; } & { fromValue: (value: { oldRoot: string | number | bigint | o1js_dist_node_lib_provable_field.Field; newRoot: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }) => { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; toInput: (x: { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { oldRoot: string; newRoot: string; deadlineSlot: string; }; fromJSON: (x: { oldRoot: string; newRoot: string; deadlineSlot: string; }) => { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; empty: () => { oldRoot: o1js_dist_node_lib_provable_field.Field; newRoot: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; }; /** * Information needed to update the approved signer */ declare class UpdateSignerData extends UpdateSignerData_base { constructor(value: { oldRoot: Field; newRoot: Field; deadlineSlot: UInt32; }); /** * Data use to create the signature * @returns array of field of all parameters */ toFields(): Field[]; hash(): Field; } declare const MultisigInfo_base: (new (value: { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }, { approvedUpgrader: bigint; messageHash: bigint; deadlineSlot: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; } & { fromValue: (value: { approvedUpgrader: string | number | bigint | o1js_dist_node_lib_provable_field.Field; messageHash: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }) => { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; toInput: (x: { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }) => { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }; fromJSON: (x: { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }) => { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; empty: () => { approvedUpgrader: o1js_dist_node_lib_provable_field.Field; messageHash: o1js_dist_node_lib_provable_field.Field; deadlineSlot: UInt32; }; }; declare class MultisigInfo extends MultisigInfo_base { constructor(value: { approvedUpgrader: Field; messageHash: Field; deadlineSlot: UInt32; }); /** * Data use to create the signature * @returns array of field of all parameters */ toFields(): Field[]; } declare const SignatureInfo_base: (new (value: { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }) => { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }, { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }; } & { fromValue: (value: { user: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; witness: any; signature: Signature | { r: Field | bigint; s: o1js.Scalar | bigint; }; right: string | number | bigint | o1js_dist_node_lib_provable_field.Field; }) => { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }; toInput: (x: { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }) => { user: string; witness: any; signature: any; right: string; }; fromJSON: (x: { user: string; witness: any; signature: any; right: string; }) => { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }; empty: () => { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: o1js_dist_node_lib_provable_field.Field; }; }; /** * Information needed to verify signature in the proof */ declare class SignatureInfo extends SignatureInfo_base { constructor(value: { user: PublicKey; witness: MerkleMapWitness; signature: Signature; right: Field; }); /** * Check if the signature match the current user and data subnit * @param merkle list of approved signer * @param data data use for the signature * @returns true if the signature is valid */ validate(merkle: Field, data: Field[]): Bool; } declare const Multisig_base: (new (value: { info: MultisigInfo; signatures: SignatureInfo[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ info: MultisigInfo; signatures: SignatureInfo[]; }, { info: { approvedUpgrader: bigint; messageHash: bigint; deadlineSlot: bigint; }; signatures: { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { info: MultisigInfo; signatures: SignatureInfo[]; }; } & { fromValue: (value: { info: MultisigInfo | { approvedUpgrader: string | number | bigint | o1js_dist_node_lib_provable_field.Field; messageHash: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }; signatures: SignatureInfo[] | { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; }; toInput: (x: { info: MultisigInfo; signatures: SignatureInfo[]; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { info: MultisigInfo; signatures: SignatureInfo[]; }) => { info: { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }; signatures: { user: string; witness: any; signature: any; right: string; }[]; }; fromJSON: (x: { info: { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }; signatures: { user: string; witness: any; signature: any; right: string; }[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; }; empty: () => { info: MultisigInfo; signatures: SignatureInfo[]; }; }; /** * Information needed to verify the signatures is correct */ declare class Multisig extends Multisig_base { constructor(value: { info: MultisigInfo; signatures: SignatureInfo[]; }); /** * Check if the signature match the current user and data submit * @param data needed to verify the signature */ verifyUpdateFactory(updateInfo: UpdateFactoryInfo): void; /** * Check if the signature match the current user and data submit * @param data needed to verify the signature */ verifyUpdateDelegator(updateInfo: UpdateAccountInfo): void; /** * Check if the signature match the current user and data submit * @param data needed to verify the signature */ verifyUpdateProtocol(updateInfo: UpdateAccountInfo): void; } declare const MultisigSigner_base: (new (value: { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }, { info: { approvedUpgrader: bigint; messageHash: bigint; deadlineSlot: bigint; }; signatures: { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; newSignatures: { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }; } & { fromValue: (value: { info: MultisigInfo | { approvedUpgrader: string | number | bigint | o1js_dist_node_lib_provable_field.Field; messageHash: string | number | bigint | o1js_dist_node_lib_provable_field.Field; deadlineSlot: number | bigint | UInt32; }; signatures: SignatureInfo[] | { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; newSignatures: SignatureInfo[] | { user: { x: bigint; isOdd: boolean; }; witness: any; signature: any; right: bigint; }[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }; toInput: (x: { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }) => { info: { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }; signatures: { user: string; witness: any; signature: any; right: string; }[]; newSignatures: { user: string; witness: any; signature: any; right: string; }[]; }; fromJSON: (x: { info: { approvedUpgrader: string; messageHash: string; deadlineSlot: string; }; signatures: { user: string; witness: any; signature: any; right: string; }[]; newSignatures: { user: string; witness: any; signature: any; right: string; }[]; }) => { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }; empty: () => { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }; }; /** * Information needed to verify the multisig is correct to update the signer list */ declare class MultisigSigner extends MultisigSigner_base { constructor(value: { info: MultisigInfo; signatures: SignatureInfo[]; newSignatures: SignatureInfo[]; }); /** * Check if the signature match the current user and data submit * @param data needed to verify the signature */ verifyUpdateSigner(upgradeInfo: UpdateSignerData): void; } /** * Check if the 2 signatures are valid */ declare function verifySignature(signatures: SignatureInfo[], deadlineSlot: UInt32, prefix: string, info: MultisigInfo, root: Field, data: Field[], right: Field): void; type PoolFactoryBase = SmartContract & { getPoolVK(): Promise<VerificationKey>; getPoolTokenHolderVK(): Promise<VerificationKey>; getProtocol(): Promise<PublicKey>; getDelegator(): Promise<PublicKey>; getApprovedSigner(): Promise<Field>; }; /** * Interface of current data needed to deploy the pool factory */ interface PoolDeployProps extends Exclude<DeployArgs, undefined> { symbol: string; src: string; protocol: PublicKey; delegator: PublicKey; approvedSigner: Field; multisig: Multisig; } declare const PoolCreationEvent_base: (new (value: { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }) => { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }, { sender: { x: bigint; isOdd: boolean; }; signer: { x: bigint; isOdd: boolean; }; poolAddress: { x: bigint; isOdd: boolean; }; token0Address: { x: bigint; isOdd: boolean; }; token1Address: { x: bigint; isOdd: boolean; }; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }; } & { fromValue: (value: { sender: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; signer: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; poolAddress: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; token0Address: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; token1Address: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; }) => { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }; toInput: (x: { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }) => { sender: string; signer: string; poolAddress: string; token0Address: string; token1Address: string; }; fromJSON: (x: { sender: string; signer: string; poolAddress: string; token0Address: string; token1Address: string; }) => { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }; empty: () => { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }; }; /** * Event emitted when a new pool is created */ declare class PoolCreationEvent extends PoolCreationEvent_base { constructor(value: { sender: PublicKey; signer: PublicKey; poolAddress: PublicKey; token0Address: PublicKey; token1Address: PublicKey; }); } declare const UpdateUserEvent_base: (new (value: { newUser: PublicKey; }) => { newUser: PublicKey; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ newUser: PublicKey; }, { newUser: { x: bigint; isOdd: boolean; }; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { newUser: PublicKey; }; } & { fromValue: (value: { newUser: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; }) => { newUser: PublicKey; }; toInput: (x: { newUser: PublicKey; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { newUser: PublicKey; }) => { newUser: string; }; fromJSON: (x: { newUser: string; }) => { newUser: PublicKey; }; empty: () => { newUser: PublicKey; }; }; /** * Event emitted when an address is updated */ declare class UpdateUserEvent extends UpdateUserEvent_base { constructor(newUser: PublicKey); } declare const UpdateVerificationKeyEvent_base: (new (value: { hash: o1js_dist_node_lib_provable_field_js.Field; }) => { hash: o1js_dist_node_lib_provable_field_js.Field; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ hash: o1js_dist_node_lib_provable_field_js.Field; }, { hash: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { hash: o1js_dist_node_lib_provable_field_js.Field; }; } & { fromValue: (value: { hash: string | number | bigint | o1js_dist_node_lib_provable_field_js.Field; }) => { hash: o1js_dist_node_lib_provable_field_js.Field; }; toInput: (x: { hash: o1js_dist_node_lib_provable_field_js.Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { hash: o1js_dist_node_lib_provable_field_js.Field; }) => { hash: string; }; fromJSON: (x: { hash: string; }) => { hash: o1js_dist_node_lib_provable_field_js.Field; }; empty: () => { hash: o1js_dist_node_lib_provable_field_js.Field; }; }; /** * Event emitted when the verification key is updated */ declare class UpdateVerificationKeyEvent extends UpdateVerificationKeyEvent_base { constructor(hash: Field); } declare const UpdateSignerEvent_base: (new (value: { root: o1js_dist_node_lib_provable_field_js.Field; }) => { root: o1js_dist_node_lib_provable_field_js.Field; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ root: o1js_dist_node_lib_provable_field_js.Field; }, { root: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { root: o1js_dist_node_lib_provable_field_js.Field; }; } & { fromValue: (value: { root: string | number | bigint | o1js_dist_node_lib_provable_field_js.Field; }) => { root: o1js_dist_node_lib_provable_field_js.Field; }; toInput: (x: { root: o1js_dist_node_lib_provable_field_js.Field; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { root: o1js_dist_node_lib_provable_field_js.Field; }) => { root: string; }; fromJSON: (x: { root: string; }) => { root: o1js_dist_node_lib_provable_field_js.Field; }; empty: () => { root: o1js_dist_node_lib_provable_field_js.Field; }; }; /** * Event emitted when the signer list is updated */ declare class UpdateSignerEvent extends UpdateSignerEvent_base { constructor(root: Field); } /** * Factory who create pools */ declare class PoolFactory extends TokenContract implements PoolFactoryBase { /** * Current verification key of pool contract, can differ between networks */ get vkPool(): VerificationKey; /** * Current verification key of pool token holder contract, can differ between networks */ get vkPoolTokenHolder(): VerificationKey; /** * List of signer approved to deploy a new pool */ approvedSigner: State<o1js_dist_node_lib_provable_field_js.Field>; /** * Account who collect protocol fees */ protocol: State<PublicKey>; /** * Delegator account for mina pools */ delegator: State<PublicKey>; /** * List of pool factory events */ events: { poolAdded: typeof PoolCreationEvent; upgrade: typeof UpdateVerificationKeyEvent; updateSigner: typeof UpdateSignerEvent; updateProtocol: typeof UpdateUserEvent; updateDelegator: typeof UpdateUserEvent; updateOwner: typeof UpdateUserEvent; }; /** * Method call when you deploy the pool factory contracts * @param args default data stored in the contracts */ deploy(args: PoolDeployProps): Promise<void>; /** * Upgrade to a new version * @param multisig multisig data * @param vk new verification key */ updateVerificationKey(multisig: Multisig, vk: VerificationKey): Promise<void>; /** * Update the list of approved signers * @param multisig multisig data * @param newRoot merkle root of the new list */ updateApprovedSigner(multisig: MultisigSigner, newRoot: Field): Promise<void>; /** * Update the protocol account address * @param multisig multisig data * @param newUser address of the new protocol collectord */ setNewProtocol(multisig: Multisig, newUser: PublicKey): Promise<void>; /** * Update the delgator address * @param multisig multisig data * @param newUser address of the new delegator */ setNewDelegator(multisig: Multisig, newUser: PublicKey): Promise<void>; /** * Get protocol address * @returns address of the protocol */ getProtocol(): Promise<PublicKey>; /** * Get delegator address * @returns address of the delegator */ getDelegator(): Promise<PublicKey>; /** * Get approved signer * @returns root of approved signer */ getApprovedSigner(): Promise<o1js_dist_node_lib_provable_field_js.Field>; /** * Get pool verification key * @returns the verification key of the pool contract */ getPoolVK(): Promise<VerificationKey>; /** * Get pool token holder verification key * @returns the verification key of the pool token holder contract */ getPoolTokenHolderVK(): Promise<VerificationKey>; /** * Method use by token allowance but it's not permissible to use it * @param forest account forest to update */ approveBase(forest: AccountUpdateForest): Promise<void>; /** * Create a new mina/token pool * @param newAccount address of the new pool * @param token token 1 for the mina pool * @param signer who sign the argument * @param signature who proves you can deploy this pool (only approved signer can deploy a pool) * @param path merkle witness to check if signer is in the approved list * @param right right of the signer */ createPool(newAccount: PublicKey, token: PublicKey, signer: PublicKey, signature: Signature, path: MerkleMapWitness, right: Field): Promise<void>; /** * Create a new token/token pool * @param newAccount address of the new pool * @param token 0 of the pool * @param token 1 of the pool * @param signer who sign the argument * @param signature who proves you can deploy this pool (only approved signer can deploy a pool) * @param path merkle witness to check if signer is in the approved list * @param right right of the signer */ createPoolToken(newAccount: PublicKey, token0: PublicKey, token1: PublicKey, signer: PublicKey, signature: Signature, path: MerkleMapWitness, right: Field): Promise<void>; private createAccounts; private createState; private createPoolHolderAccount; } declare const FarmingInfo_base: (new (value: { startTimestamp: UInt64; endTimestamp: UInt64; }) => { startTimestamp: UInt64; endTimestamp: UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ startTimestamp: UInt64; endTimestamp: UInt64; }, { startTimestamp: bigint; endTimestamp: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { startTimestamp: UInt64; endTimestamp: UInt64; }; } & { fromValue: (value: { startTimestamp: number | bigint | UInt64; endTimestamp: number | bigint | UInt64; }) => { startTimestamp: UInt64; endTimestamp: UInt64; }; toInput: (x: { startTimestamp: UInt64; endTimestamp: UInt64; }) => { fields?: o1js.Field[] | undefined; packed?: [o1js.Field, number][] | undefined; }; toJSON: (x: { startTimestamp: UInt64; endTimestamp: UInt64; }) => { startTimestamp: string; endTimestamp: string; }; fromJSON: (x: { startTimestamp: string; endTimestamp: string; }) => { startTimestamp: UInt64; endTimestamp: UInt64; }; empty: () => { startTimestamp: UInt64; endTimestamp: UInt64; }; }; declare class FarmingInfo extends FarmingInfo_base { constructor(value: { startTimestamp: UInt64; endTimestamp: UInt64; }); } declare const FarmingEvent_base: (new (value: { sender: PublicKey; amount: UInt64; }) => { sender: PublicKey; amount: UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ sender: PublicKey; amount: UInt64; }, { sender: { x: bigint; isOdd: boolean; }; amount: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { sender: PublicKey; amount: UInt64; }; } & { fromValue: (value: { sender: PublicKey | { x: o1js.Field | bigint; isOdd: Bool | boolean; }; amount: number | bigint | UInt64; }) => { sender: PublicKey; amount: UInt64; }; toInput: (x: { sender: PublicKey; amount: UInt64; }) => { fields?: o1js.Field[] | undefined; packed?: [o1js.Field, number][] | undefined; }; toJSON: (x: { sender: PublicKey; amount: UInt64; }) => { sender: string; amount: string; }; fromJSON: (x: { sender: string; amount: string; }) => { sender: PublicKey; amount: UInt64; }; empty: () => { sender: PublicKey; amount: UInt64; }; }; declare class FarmingEvent extends FarmingEvent_base { constructor(value: { sender: PublicKey; amount: UInt64; }); } declare const BurnEvent_base: (new (value: { sender: PublicKey; amount: UInt64; }) => { sender: PublicKey; amount: UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ sender: PublicKey; amount: UInt64; }, { sender: { x: bigint; isOdd: boolean; }; amount: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { sender: PublicKey; amount: UInt64; }; } & { fromValue: (value: { sender: PublicKey | { x: o1js.Field | bigint; isOdd: Bool | boolean; }; amount: number | bigint | UInt64; }) => { sender: PublicKey; amount: UInt64; }; toInput: (x: { sender: PublicKey; amount: UInt64; }) => { fields?: o1js.Field[] | undefined; packed?: [o1js.Field, number][] | undefined; }; toJSON: (x: { sender: PublicKey; amount: UInt64; }) => { sender: string; amount: string; }; fromJSON: (x: { sender: string; amount: string; }) => { sender: PublicKey; amount: UInt64; }; empty: () => { sender: PublicKey; amount: UInt64; }; }; declare class BurnEvent extends BurnEvent_base { constructor(value: { sender: PublicKey; amount: UInt64; }); } declare const UpdateInitEvent_base: (new (value: { owner: PublicKey; }) => { owner: PublicKey; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ owner: PublicKey; }, { owner: { x: bigint; isOdd: boolean; }; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { owner: PublicKey; }; } & { fromValue: (value: { owner: PublicKey | { x: o1js.Field | bigint; isOdd: Bool | boolean; }; }) => { owner: PublicKey; }; toInput: (x: { owner: PublicKey; }) => { fields?: o1js.Field[] | undefined; packed?: [o1js.Field, number][] | undefined; }; toJSON: (x: { owner: PublicKey; }) => { owner: string; }; fromJSON: (x: { owner: string; }) => { owner: PublicKey; }; empty: () => { owner: PublicKey; }; }; declare class UpdateInitEvent extends UpdateInitEvent_base { constructor(value: { owner: PublicKey; }); } interface FarmingDeployProps$1 extends Exclude<DeployArgs, undefined> { pool: PublicKey; owner: PublicKey; startSlot: UInt64; endSlot: UInt64; } /** * Farm contract */ declare class Farm extends TokenContract { pool: State<PublicKey>; owner: State<PublicKey>; startTimestamp: State<UInt64>; endTimestamp: State<UInt64>; timeUnlock: State<UInt64>; events: { upgrade: typeof UpdateVerificationKeyEvent; upgradeInited: typeof UpdateInitEvent; deposit: typeof FarmingEvent; burn: typeof BurnEvent; }; deploy(args: FarmingDeployProps$1): Promise<void>; /** * Transfer is locked only depositor can withdraw his token */ approveBase(updates: AccountUpdateForest): Promise<void>; /** * Init Upgrade to a new version * @param vk new verification key */ initUpdate(startTime: UInt64): Promise<void>; /** * Upgrade to a new version * @param vk new verification key */ updateVerificationKey(vk: VerificationKey): Promise<void>; deposit(amount: UInt64): Promise<void>; /** * Don't call this method directly */ burnLiquidity(sender: PublicKey, amount: UInt64): Promise<void>; } interface FarmRewardDeployProps extends Exclude<DeployArgs, undefined> { merkleRoot: Field; token: PublicKey; owner: PublicKey; } declare const MintEvent_base: (new (value: { sender: PublicKey; }) => { sender: PublicKey; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ sender: PublicKey; }, { sender: { x: bigint; isOdd: boolean; }; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { sender: PublicKey; }; } & { fromValue: (value: { sender: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; }) => { sender: PublicKey; }; toInput: (x: { sender: PublicKey; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { sender: PublicKey; }) => { sender: string; }; fromJSON: (x: { sender: string; }) => { sender: PublicKey; }; empty: () => { sender: PublicKey; }; }; declare class MintEvent extends MintEvent_base { constructor(value: { sender: PublicKey; }); } declare const ClaimEvent_base: (new (value: { user: PublicKey; amount: UInt64; }) => { user: PublicKey; amount: UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf.Provable<{ user: PublicKey; amount: UInt64; }, { user: { x: bigint; isOdd: boolean; }; amount: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field.Field[]) => { user: PublicKey; amount: UInt64; }; } & { fromValue: (value: { user: PublicKey | { x: Field | bigint; isOdd: Bool | boolean; }; amount: number | bigint | UInt64; }) => { user: PublicKey; amount: UInt64; }; toInput: (x: { user: PublicKey; amount: UInt64; }) => { fields?: Field[] | undefined; packed?: [Field, number][] | undefined; }; toJSON: (x: { user: PublicKey; amount: UInt64; }) => { user: string; amount: string; }; fromJSON: (x: { user: string; amount: string; }) => { user: PublicKey; amount: UInt64; }; empty: () => { user: PublicKey; amount: UInt64; }; }; declare class ClaimEvent extends ClaimEvent_base { constructor(value: { user: PublicKey; amount: UInt64; }); } /** * support 2^32 different claimer (easily adjustable) */ declare const claimerNumber = 32; declare const FarmMerkleWitness_base: typeof o1js_dist_node_lib_provable_merkle_tree.BaseMerkleWitness; declare class FarmMerkleWitness extends FarmMerkleWitness_base { } /** * we can't upgrade the contract before 1 day */ declare const minTimeUnlockFarmReward: UInt64; /** * Farm reward contract */ declare class FarmReward extends TokenContract { owner: State<PublicKey>; token: State<PublicKey>; merkleRoot: State<o1js_dist_node_lib_provable_field.Field>; timeUnlock: State<UInt64>; events: { upgrade: typeof UpdateVerificationKeyEvent; upgradeInited: typeof UpdateInitEvent; claim: typeof ClaimEvent; mint: typeof MintEvent; }; deploy(args: FarmRewardDeployProps): Promise<void>; /** Approve `AccountUpdate`s that have been created outside of the token contract. * * @argument {AccountUpdateForest} updates - The `AccountUpdate`s to approve. Note that the forest size is limited by the base token contract, @see TokenContract.MAX_ACCOUNT_UPDATES The current limit is 9. */ approveBase(updates: AccountUpdateForest): Promise<void>; /** * Init Upgrade to a new version * @param vk new verification key */ initUpdate(startTime: UInt64): Promise<void>; /** * Upgrade to a new version * @param vk new verification key */ updateVerificationKey(vk: VerificationKey): Promise<void>; claimReward(amount: UInt64, path: FarmMerkleWitness): Promise<void>; /** * Don't call this method directly */ mint(sender: PublicKey): Promise<void>; } /** * Farm reward contract in case of the reward in fungible token */ declare class FarmRewardTokenHolder extends FarmReward { deploy(args: FarmRewardDeployProps): Promise<void>; claimReward(amount: UInt64, path: FarmMerkleWitness): Promise<void>; } interface FarmingDeployProps extends Exclude<DeployArgs, undefined> { owner: PublicKey; } /** * Farm contract */ declare class FarmTokenHolder extends SmartContract { owner: State<PublicKey>; timeUnlock: State<UInt64>; events: { upgrade: typeof UpdateVerificationKeyEvent; upgradeInited: typeof UpdateInitEvent; withdraw: typeof FarmingEvent; }; deploy(args: FarmingDeployProps): Promise<void>; /** * Transfer is locked only depositor can withdraw his token */ approveBase(updates: AccountUpdateForest): Promise<void>; /** * Init Upgrade to a new version * @param vk new verification key */ initUpdate(startTime: UInt64): Promise<void>; /** * Upgrade to a new version * @param vk new verification key */ updateVerificationKey(vk: VerificationKey): Promise<void>; withdraw(amount: UInt64): Promise<void>; } /** * Function to multiply one Uint64 by another and divide the result, * We check for overflow on the final result to avoid a premature overflow error. * @param a The multiplicand * @param b The multiplier * @param denominator The divisor * @returns the quotient and the remainder */ declare function mulDivMod(a: UInt64, b: UInt64, denominator: UInt64): { quotient: UInt64; rest: UInt64; }; /** * Function to multiply one Uint64 by another and divide the result, * We check for overflow on the final result to avoid a premature overflow error. * @param a The multiplicand * @param b The multiplier * @param denominator The divisor * @returns The 64-bit result */ declare function mulDiv(a: UInt64, b: UInt64, denominator: UInt64): UInt64; /** * Data needed by pool and pool token */ interface IPool { token0: State<PublicKey>; token1: State<PublicKey>; poolFactory: State<PublicKey>; } declare const SwapEvent_base: (new (value: { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }) => { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }, { sender: { x: bigint; isOdd: boolean; }; amountIn: bigint; amountOut: bigint; }>, "fromFields"> & { fromFields: (fields: o1js_dist_node_lib_provable_field_js.Field[]) => { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }; } & { fromValue: (value: { sender: PublicKey | { x: Types.Field | bigint; isOdd: Bool | boolean; }; amountIn: number | bigint | Types.UInt64; amountOut: number | bigint | Types.UInt64; }) => { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }; toInput: (x: { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }) => { fields?: Types.Field[] | undefined; packed?: [Types.Field, number][] | undefined; }; toJSON: (x: { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }) => { sender: string; amountIn: string; amountOut: string; }; fromJSON: (x: { sender: string; amountIn: string; amountOut: string; }) => { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }; empty: () => { sender: PublicKey; amountIn: Types.UInt64; amountOut: Types.UInt64; }; }; /** * Event emitted when a swap is validated */ declare class SwapEvent extends SwapEvent_base { constructor(value: { sender: PublicKey; amountIn: UInt64; amountOut: UInt64; }); } declare const ReceiveMinaEvent_base: (new (value: { sender: PublicKey; amountMinaIn: Types.UInt64; }) => { sender: PublicKey; amountMinaIn: Types.UInt64; }) & { _isStruct: true; } & Omit<o1js_dist_node_lib_provable_types_provable_intf_js.Provable<{ sender: PublicKey; amountMinaIn: Types.UInt64; }, { sender: { x: bigint; isOdd: boolean