UNPKG

@nori-zk/mina-token-bridge

Version:

Nori ethereum state settelment and nETH token bridge zkApp

34 lines (33 loc) 2.06 kB
import { Field, SmartContract, State } from 'o1js'; /** * The contract stores the cumulative amount of token user has minted or burned. * * NOTE: Accounts with this contract deployed normally is a `Token Holder Account` based on specific `Token Owner Account` with `NoriTokenController` deployed. * * NOTE: Since all operations on `Token Holder Account` require token owner's approval, we migrate `operations validity check`(like signature check, etc.) into token owner's methods invoked by user. */ export declare class NoriStorageInterface extends SmartContract { userKeyHash: State<import("o1js/dist/node/lib/provable/field.js").Field>; mintedSoFar: State<import("o1js/dist/node/lib/provable/field.js").Field>; burnedSoFar: State<import("o1js/dist/node/lib/provable/field.js").Field>; receiver: State<import("o1js/dist/node/lib/provable/field.js").Field>; /** * calc amount to Mint and maintain `mintedSoFar` * * NOTE: Since all operations on `Token Holder Account` require token owner's approval, we migrate `operations validity check`(like signature check, etc.) into token owner's methods invoked by user. * * @param lockedSoFar the cumulative amount of user's locked token on Ethereum contract side * @returns amount to Mint */ increaseMintedAmount(lockedSoFar: Field): Promise<import("o1js/dist/node/lib/provable/field.js").Field>; /** * Adds `amountToBurn` to the cumulative `burnedSoFar` and records the receiver. * * NOTE: Since all operations on `Token Holder Account` require token owner's approval, we migrate `operations validity check`(like signature check, etc.) into token owner's methods invoked by user. * * @param amountToBurn the amount being burned in this call * @param receiver the Ethereum receiver address (Field-encoded) * @returns the new cumulative `burnedSoFar` after adding `amountToBurn` */ addBurnGetCumulative(amountToBurn: Field, receiver: Field): Promise<import("o1js/dist/node/lib/provable/field.js").Field>; }