#One or more proofs were invalid

2 messages · Page 1 of 1 (latest)

hard walrus
#

Hello,

I'm working on simple vault, I try to deposit mina and a customtoken in the vault, test work well if proofenabled= false, but failed with proofenabled

My code :

    @method async create(tokenA: PublicKey, amountA: UInt64, amountMina: UInt64) {
        const addressA = this.tokenA.getAndRequireEquals();

        addressA.isEmpty().assertTrue("Vault already initialised");

        amountA.assertGreaterThan(UInt64.zero, "No amount A supplied");
        amountMina.assertGreaterThan(UInt64.zero, "No amount Mina supplied");

        let tokenContractA = new TokenStandard(tokenA);

        let sender = this.sender.getAndRequireSignature();
        let senderUpdate = AccountUpdate.createSigned(sender);

        await tokenContractA.transfer(sender, this.address, amountA);
        await senderUpdate.send({ to: this, amount: amountMina });

        let liquidityAmount = amountA.add(amountMina);
        // mint token
        this.internal.mint({ address: sender, amount: liquidityAmount });

        // set default informations
        this.tokenA.set(tokenA);
        this.liquiditySupply.set(liquidityAmount);
    }

The problem : await tokenContractA.transfer(sender, this.address, amountA);

My test :

    it('create vault', async () => {
        let amt = UInt64.from(10 * 10 ** 9);
        const txn = await Mina.transaction(senderAccount, async () => {
            AccountUpdate.fundNewAccount(senderAccount, 2);
            await zkApp.create(zkToken0Address, amt, amt);
        });
        console.log("createPool", txn.toPretty());
        await txn.prove();
        await txn.sign([senderKey, zkAppPrivateKey]).send();

        const liquidityUser = Mina.getBalance(senderAccount, zkApp.deriveTokenId());
        const expected = amt.value.add(amt.value);
        console.log("liquidity user", liquidityUser.toString());
        expect(liquidityUser.value).toEqual(expected);
    });

The full source code
https://github.com/youtpout/vault/tree/main/contracts

acoustic hedge
#

How many AccountUpdates your tx has?