@coti-io/coti-contracts-examples
Version:
Example smart contracts demonstrating the use of COTI's GC technology, including integrations with MPC, private ERC20, and ERC721 contracts.
899 lines (838 loc) • 24.5 kB
text/typescript
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
BaseContract,
BigNumberish,
BytesLike,
FunctionFragment,
Result,
Interface,
EventFragment,
AddressLike,
ContractRunner,
ContractMethod,
Listener,
} from "ethers";
import type {
TypedContractEvent,
TypedDeferredTopicFilter,
TypedEventLog,
TypedLogDescription,
TypedListener,
TypedContractMethod,
} from "../common";
export type ItUint64Struct = { ciphertext: BigNumberish; signature: BytesLike };
export type ItUint64StructOutput = [ciphertext: bigint, signature: string] & {
ciphertext: bigint;
signature: string;
};
export declare namespace DataPrivacyFramework {
export type ConditionStruct = {
id: BigNumberish;
caller: AddressLike;
operation: string;
active: boolean;
falseKey: boolean;
trueKey: boolean;
timestampBefore: BigNumberish;
timestampAfter: BigNumberish;
uintParameter: BigNumberish;
addressParameter: AddressLike;
stringParameter: string;
};
export type ConditionStructOutput = [
id: bigint,
caller: string,
operation: string,
active: boolean,
falseKey: boolean,
trueKey: boolean,
timestampBefore: bigint,
timestampAfter: bigint,
uintParameter: bigint,
addressParameter: string,
stringParameter: string
] & {
id: bigint;
caller: string;
operation: string;
active: boolean;
falseKey: boolean;
trueKey: boolean;
timestampBefore: bigint;
timestampAfter: bigint;
uintParameter: bigint;
addressParameter: string;
stringParameter: string;
};
export type InputDataStruct = {
caller: AddressLike;
operation: string;
active: boolean;
timestampBefore: BigNumberish;
timestampAfter: BigNumberish;
falseKey: boolean;
trueKey: boolean;
uintParameter: BigNumberish;
addressParameter: AddressLike;
stringParameter: string;
};
export type InputDataStructOutput = [
caller: string,
operation: string,
active: boolean,
timestampBefore: bigint,
timestampAfter: bigint,
falseKey: boolean,
trueKey: boolean,
uintParameter: bigint,
addressParameter: string,
stringParameter: string
] & {
caller: string;
operation: string;
active: boolean;
timestampBefore: bigint;
timestampAfter: bigint;
falseKey: boolean;
trueKey: boolean;
uintParameter: bigint;
addressParameter: string;
stringParameter: string;
};
}
export declare namespace OnChainDatabase {
export type DatabaseEntryStruct = {
key: string;
creator: AddressLike;
createTimestamp: BigNumberish;
lastAccessTimestamp: BigNumberish;
};
export type DatabaseEntryStructOutput = [
key: string,
creator: string,
createTimestamp: bigint,
lastAccessTimestamp: bigint
] & {
key: string;
creator: string;
createTimestamp: bigint;
lastAccessTimestamp: bigint;
};
}
export interface OnChainDatabaseInterface extends Interface {
getFunction(
nameOrSignature:
| "ADDRESS_ALL"
| "STRING_ALL"
| "activePermissions"
| "add"
| "addAllowedOperation"
| "addRestrictedOperation"
| "addressDefaultPermission"
| "allowedOperations"
| "conditions"
| "decrypt"
| "getClearCotiUsdPrice"
| "getClearOilCotiPrice"
| "getClearOilUsdPrice"
| "getConditions"
| "getConditionsCount"
| "getItem"
| "getItems"
| "greaterThan"
| "isOperationAllowed(address,string,uint256)"
| "isOperationAllowed(address,string)"
| "isOperationAllowed(address,string,string)"
| "isOperationAllowed(address,string,address)"
| "lessThan"
| "operationDefaultPermission"
| "permissions"
| "removeAllowedOperation"
| "removeRestrictedOperation"
| "restrictedOperations"
| "setAddressDefaultPermission"
| "setItem"
| "setOperationDefaultPermission"
| "setPermission"
| "subtract"
): FunctionFragment;
getEvent(
nameOrSignatureOrTopic: "clearUint" | "encryptedBool" | "encryptedUint"
): EventFragment;
encodeFunctionData(
functionFragment: "ADDRESS_ALL",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "STRING_ALL",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "activePermissions",
values: [AddressLike]
): string;
encodeFunctionData(
functionFragment: "add",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "addAllowedOperation",
values: [string]
): string;
encodeFunctionData(
functionFragment: "addRestrictedOperation",
values: [string]
): string;
encodeFunctionData(
functionFragment: "addressDefaultPermission",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "allowedOperations",
values: [string]
): string;
encodeFunctionData(
functionFragment: "conditions",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "decrypt", values: [string]): string;
encodeFunctionData(
functionFragment: "getClearCotiUsdPrice",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "getClearOilCotiPrice",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "getClearOilUsdPrice",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "getConditions",
values: [BigNumberish, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "getConditionsCount",
values?: undefined
): string;
encodeFunctionData(functionFragment: "getItem", values: [string]): string;
encodeFunctionData(functionFragment: "getItems", values?: undefined): string;
encodeFunctionData(
functionFragment: "greaterThan",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "isOperationAllowed(address,string,uint256)",
values: [AddressLike, string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "isOperationAllowed(address,string)",
values: [AddressLike, string]
): string;
encodeFunctionData(
functionFragment: "isOperationAllowed(address,string,string)",
values: [AddressLike, string, string]
): string;
encodeFunctionData(
functionFragment: "isOperationAllowed(address,string,address)",
values: [AddressLike, string, AddressLike]
): string;
encodeFunctionData(
functionFragment: "lessThan",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "operationDefaultPermission",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "permissions",
values: [AddressLike, string]
): string;
encodeFunctionData(
functionFragment: "removeAllowedOperation",
values: [string]
): string;
encodeFunctionData(
functionFragment: "removeRestrictedOperation",
values: [string]
): string;
encodeFunctionData(
functionFragment: "restrictedOperations",
values: [string]
): string;
encodeFunctionData(
functionFragment: "setAddressDefaultPermission",
values: [boolean]
): string;
encodeFunctionData(
functionFragment: "setItem",
values: [string, ItUint64Struct]
): string;
encodeFunctionData(
functionFragment: "setOperationDefaultPermission",
values: [boolean]
): string;
encodeFunctionData(
functionFragment: "setPermission",
values: [DataPrivacyFramework.InputDataStruct]
): string;
encodeFunctionData(
functionFragment: "subtract",
values: [string, BigNumberish]
): string;
decodeFunctionResult(
functionFragment: "ADDRESS_ALL",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "STRING_ALL", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "activePermissions",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "add", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "addAllowedOperation",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "addRestrictedOperation",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "addressDefaultPermission",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "allowedOperations",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "conditions", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "decrypt", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "getClearCotiUsdPrice",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getClearOilCotiPrice",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getClearOilUsdPrice",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getConditions",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getConditionsCount",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "getItem", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getItems", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "greaterThan",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isOperationAllowed(address,string,uint256)",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isOperationAllowed(address,string)",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isOperationAllowed(address,string,string)",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "isOperationAllowed(address,string,address)",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "lessThan", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "operationDefaultPermission",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "permissions",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "removeAllowedOperation",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "removeRestrictedOperation",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "restrictedOperations",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "setAddressDefaultPermission",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "setItem", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "setOperationDefaultPermission",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "setPermission",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "subtract", data: BytesLike): Result;
}
export namespace clearUintEvent {
export type InputTuple = [_from: AddressLike, value: BigNumberish];
export type OutputTuple = [_from: string, value: bigint];
export interface OutputObject {
_from: string;
value: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace encryptedBoolEvent {
export type InputTuple = [_from: AddressLike, value: BigNumberish];
export type OutputTuple = [_from: string, value: bigint];
export interface OutputObject {
_from: string;
value: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export namespace encryptedUintEvent {
export type InputTuple = [_from: AddressLike, value: BigNumberish];
export type OutputTuple = [_from: string, value: bigint];
export interface OutputObject {
_from: string;
value: bigint;
}
export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
export type Filter = TypedDeferredTopicFilter<Event>;
export type Log = TypedEventLog<Event>;
export type LogDescription = TypedLogDescription<Event>;
}
export interface OnChainDatabase extends BaseContract {
connect(runner?: ContractRunner | null): OnChainDatabase;
waitForDeployment(): Promise<this>;
interface: OnChainDatabaseInterface;
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;
on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;
listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;
ADDRESS_ALL: TypedContractMethod<[], [string], "view">;
STRING_ALL: TypedContractMethod<[], [string], "view">;
activePermissions: TypedContractMethod<[arg0: AddressLike], [bigint], "view">;
add: TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
addAllowedOperation: TypedContractMethod<
[operation: string],
[boolean],
"nonpayable"
>;
addRestrictedOperation: TypedContractMethod<
[operation: string],
[boolean],
"nonpayable"
>;
addressDefaultPermission: TypedContractMethod<[], [boolean], "view">;
allowedOperations: TypedContractMethod<[arg0: string], [boolean], "view">;
conditions: TypedContractMethod<
[arg0: BigNumberish],
[
[
bigint,
string,
string,
boolean,
boolean,
boolean,
bigint,
bigint,
bigint,
string,
string
] & {
id: bigint;
caller: string;
operation: string;
active: boolean;
falseKey: boolean;
trueKey: boolean;
timestampBefore: bigint;
timestampAfter: bigint;
uintParameter: bigint;
addressParameter: string;
stringParameter: string;
}
],
"view"
>;
decrypt: TypedContractMethod<[name: string], [void], "nonpayable">;
getClearCotiUsdPrice: TypedContractMethod<[], [void], "nonpayable">;
getClearOilCotiPrice: TypedContractMethod<[], [void], "nonpayable">;
getClearOilUsdPrice: TypedContractMethod<[], [void], "nonpayable">;
getConditions: TypedContractMethod<
[startIdx: BigNumberish, chunkSize: BigNumberish],
[DataPrivacyFramework.ConditionStructOutput[]],
"view"
>;
getConditionsCount: TypedContractMethod<[], [bigint], "view">;
getItem: TypedContractMethod<[name: string], [void], "nonpayable">;
getItems: TypedContractMethod<
[],
[OnChainDatabase.DatabaseEntryStructOutput[]],
"view"
>;
greaterThan: TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
"isOperationAllowed(address,string,uint256)": TypedContractMethod<
[caller: AddressLike, operation: string, uintParameter: BigNumberish],
[boolean],
"view"
>;
"isOperationAllowed(address,string)": TypedContractMethod<
[caller: AddressLike, operation: string],
[boolean],
"view"
>;
"isOperationAllowed(address,string,string)": TypedContractMethod<
[caller: AddressLike, operation: string, stringParameter: string],
[boolean],
"view"
>;
"isOperationAllowed(address,string,address)": TypedContractMethod<
[caller: AddressLike, operation: string, addressParameter: AddressLike],
[boolean],
"view"
>;
lessThan: TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
operationDefaultPermission: TypedContractMethod<[], [boolean], "view">;
permissions: TypedContractMethod<
[arg0: AddressLike, arg1: string],
[bigint],
"view"
>;
removeAllowedOperation: TypedContractMethod<
[operation: string],
[boolean],
"nonpayable"
>;
removeRestrictedOperation: TypedContractMethod<
[operation: string],
[boolean],
"nonpayable"
>;
restrictedOperations: TypedContractMethod<[arg0: string], [boolean], "view">;
setAddressDefaultPermission: TypedContractMethod<
[defaultPermission: boolean],
[boolean],
"nonpayable"
>;
setItem: TypedContractMethod<
[name: string, value: ItUint64Struct],
[void],
"nonpayable"
>;
setOperationDefaultPermission: TypedContractMethod<
[defaultPermission: boolean],
[boolean],
"nonpayable"
>;
setPermission: TypedContractMethod<
[inputData: DataPrivacyFramework.InputDataStruct],
[boolean],
"nonpayable"
>;
subtract: TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
getFunction<T extends ContractMethod = ContractMethod>(
key: string | FunctionFragment
): T;
getFunction(
nameOrSignature: "ADDRESS_ALL"
): TypedContractMethod<[], [string], "view">;
getFunction(
nameOrSignature: "STRING_ALL"
): TypedContractMethod<[], [string], "view">;
getFunction(
nameOrSignature: "activePermissions"
): TypedContractMethod<[arg0: AddressLike], [bigint], "view">;
getFunction(
nameOrSignature: "add"
): TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "addAllowedOperation"
): TypedContractMethod<[operation: string], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "addRestrictedOperation"
): TypedContractMethod<[operation: string], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "addressDefaultPermission"
): TypedContractMethod<[], [boolean], "view">;
getFunction(
nameOrSignature: "allowedOperations"
): TypedContractMethod<[arg0: string], [boolean], "view">;
getFunction(
nameOrSignature: "conditions"
): TypedContractMethod<
[arg0: BigNumberish],
[
[
bigint,
string,
string,
boolean,
boolean,
boolean,
bigint,
bigint,
bigint,
string,
string
] & {
id: bigint;
caller: string;
operation: string;
active: boolean;
falseKey: boolean;
trueKey: boolean;
timestampBefore: bigint;
timestampAfter: bigint;
uintParameter: bigint;
addressParameter: string;
stringParameter: string;
}
],
"view"
>;
getFunction(
nameOrSignature: "decrypt"
): TypedContractMethod<[name: string], [void], "nonpayable">;
getFunction(
nameOrSignature: "getClearCotiUsdPrice"
): TypedContractMethod<[], [void], "nonpayable">;
getFunction(
nameOrSignature: "getClearOilCotiPrice"
): TypedContractMethod<[], [void], "nonpayable">;
getFunction(
nameOrSignature: "getClearOilUsdPrice"
): TypedContractMethod<[], [void], "nonpayable">;
getFunction(
nameOrSignature: "getConditions"
): TypedContractMethod<
[startIdx: BigNumberish, chunkSize: BigNumberish],
[DataPrivacyFramework.ConditionStructOutput[]],
"view"
>;
getFunction(
nameOrSignature: "getConditionsCount"
): TypedContractMethod<[], [bigint], "view">;
getFunction(
nameOrSignature: "getItem"
): TypedContractMethod<[name: string], [void], "nonpayable">;
getFunction(
nameOrSignature: "getItems"
): TypedContractMethod<
[],
[OnChainDatabase.DatabaseEntryStructOutput[]],
"view"
>;
getFunction(
nameOrSignature: "greaterThan"
): TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "isOperationAllowed(address,string,uint256)"
): TypedContractMethod<
[caller: AddressLike, operation: string, uintParameter: BigNumberish],
[boolean],
"view"
>;
getFunction(
nameOrSignature: "isOperationAllowed(address,string)"
): TypedContractMethod<
[caller: AddressLike, operation: string],
[boolean],
"view"
>;
getFunction(
nameOrSignature: "isOperationAllowed(address,string,string)"
): TypedContractMethod<
[caller: AddressLike, operation: string, stringParameter: string],
[boolean],
"view"
>;
getFunction(
nameOrSignature: "isOperationAllowed(address,string,address)"
): TypedContractMethod<
[caller: AddressLike, operation: string, addressParameter: AddressLike],
[boolean],
"view"
>;
getFunction(
nameOrSignature: "lessThan"
): TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "operationDefaultPermission"
): TypedContractMethod<[], [boolean], "view">;
getFunction(
nameOrSignature: "permissions"
): TypedContractMethod<[arg0: AddressLike, arg1: string], [bigint], "view">;
getFunction(
nameOrSignature: "removeAllowedOperation"
): TypedContractMethod<[operation: string], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "removeRestrictedOperation"
): TypedContractMethod<[operation: string], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "restrictedOperations"
): TypedContractMethod<[arg0: string], [boolean], "view">;
getFunction(
nameOrSignature: "setAddressDefaultPermission"
): TypedContractMethod<[defaultPermission: boolean], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "setItem"
): TypedContractMethod<
[name: string, value: ItUint64Struct],
[void],
"nonpayable"
>;
getFunction(
nameOrSignature: "setOperationDefaultPermission"
): TypedContractMethod<[defaultPermission: boolean], [boolean], "nonpayable">;
getFunction(
nameOrSignature: "setPermission"
): TypedContractMethod<
[inputData: DataPrivacyFramework.InputDataStruct],
[boolean],
"nonpayable"
>;
getFunction(
nameOrSignature: "subtract"
): TypedContractMethod<
[name: string, value: BigNumberish],
[void],
"nonpayable"
>;
getEvent(
key: "clearUint"
): TypedContractEvent<
clearUintEvent.InputTuple,
clearUintEvent.OutputTuple,
clearUintEvent.OutputObject
>;
getEvent(
key: "encryptedBool"
): TypedContractEvent<
encryptedBoolEvent.InputTuple,
encryptedBoolEvent.OutputTuple,
encryptedBoolEvent.OutputObject
>;
getEvent(
key: "encryptedUint"
): TypedContractEvent<
encryptedUintEvent.InputTuple,
encryptedUintEvent.OutputTuple,
encryptedUintEvent.OutputObject
>;
filters: {
"clearUint(address,uint64)": TypedContractEvent<
clearUintEvent.InputTuple,
clearUintEvent.OutputTuple,
clearUintEvent.OutputObject
>;
clearUint: TypedContractEvent<
clearUintEvent.InputTuple,
clearUintEvent.OutputTuple,
clearUintEvent.OutputObject
>;
"encryptedBool(address,uint256)": TypedContractEvent<
encryptedBoolEvent.InputTuple,
encryptedBoolEvent.OutputTuple,
encryptedBoolEvent.OutputObject
>;
encryptedBool: TypedContractEvent<
encryptedBoolEvent.InputTuple,
encryptedBoolEvent.OutputTuple,
encryptedBoolEvent.OutputObject
>;
"encryptedUint(address,uint256)": TypedContractEvent<
encryptedUintEvent.InputTuple,
encryptedUintEvent.OutputTuple,
encryptedUintEvent.OutputObject
>;
encryptedUint: TypedContractEvent<
encryptedUintEvent.InputTuple,
encryptedUintEvent.OutputTuple,
encryptedUintEvent.OutputObject
>;
};
}