@silvana-one/token
Version:
Silvana Fungible Token Library
90 lines (89 loc) • 2.64 kB
TypeScript
import { DeployArgs, PublicKey, State, UInt64, SmartContract, Bool, Field } from "o1js";
import { Whitelist } from "@silvana-one/storage";
declare const ClaimEvent_base: (new (value: {
amount: UInt64;
address: PublicKey;
}) => {
amount: UInt64;
address: PublicKey;
}) & {
_isStruct: true;
} & Omit<import("node_modules/o1js/dist/node/lib/provable/types/provable-intf.js").Provable<{
amount: UInt64;
address: PublicKey;
}, {
amount: bigint;
address: {
x: bigint;
isOdd: boolean;
};
}>, "fromFields"> & {
fromFields: (fields: import("node_modules/o1js/dist/node/lib/provable/field.js").Field[]) => {
amount: UInt64;
address: PublicKey;
};
} & {
fromValue: (value: {
amount: number | bigint | UInt64;
address: PublicKey | {
x: Field | bigint;
isOdd: Bool | boolean;
};
}) => {
amount: UInt64;
address: PublicKey;
};
toInput: (x: {
amount: UInt64;
address: PublicKey;
}) => {
fields?: Field[] | undefined;
packed?: [Field, number][] | undefined;
};
toJSON: (x: {
amount: UInt64;
address: PublicKey;
}) => {
amount: string;
address: string;
};
fromJSON: (x: {
amount: string;
address: string;
}) => {
amount: UInt64;
address: PublicKey;
};
empty: () => {
amount: UInt64;
address: PublicKey;
};
};
declare class ClaimEvent extends ClaimEvent_base {
}
export interface FungibleTokenClaimContractDeployProps extends Exclude<DeployArgs, undefined> {
/** The whitelist. */
whitelist: Whitelist;
/** The maximum amount of tokens to claim in case the whitelist is empty. */
maxAmount?: UInt64;
}
export declare class FungibleTokenClaimContract extends SmartContract {
owner: State<PublicKey>;
token: State<PublicKey>;
whitelist: State<Whitelist>;
maxAmount: State<UInt64>;
deploy(args: FungibleTokenClaimContractDeployProps): Promise<void>;
events: {
offer: typeof ClaimEvent;
withdraw: typeof ClaimEvent;
claim: typeof ClaimEvent;
updateWhitelist: typeof Whitelist;
};
initialize(owner: PublicKey, // we are short of AccountUpdates here, so we use this parameter instead of this.sender.getUnconstrained()
token: PublicKey, amount: UInt64): Promise<void>;
offer(amount: UInt64): Promise<void>;
withdraw(amount: UInt64): Promise<void>;
claim(amount: UInt64): Promise<void>;
updateWhitelist(whitelist: Whitelist): Promise<void>;
}
export {};