0

I'm trying to mint from a program with a multisig authority.

The idea basically is to have a token-mint with multisig (1-N) authority [created with native solana-spl createMultisig.

I put the program PDA address as one of the multisigners, but doesn't work...

use anchor_spl::token_2022::spl_token_2022::instruction::mint_to;
....
let ix = mint_to(
        &ctx.accounts.token_program,
        ctx.accounts.mint.key(),
        ctx.accounts.to.key(),
        ctx.accounts.multisig.key(),
        &[&multisig.key()],
        amount,
    )?;
    anchor_lang::solana_program::program::invoke_signed(
        &ix,
        &[
            ctx.accounts.to.to_account_info(),
            ctx.accounts.mint.to_account_info(),
            ctx.accounts.multisig.to_account_info(),
            ctx.accounts.pool.to_account_info(), // PDA signer
        ],
        compute_seed(ctx.accounts.pool), // <= this works without the multisig authority
    )

I tried a bunch of different combinations for the authority and the signers array, always get escalated priv, or "can't compute signer address". In the test file I played with the .remainingAccounts with isWritable/isSigner without luck...

If anyone can point me to a real example or where is my issue would be awesome =D Thanks in advance.

1 Answer 1

0

You're very close! You just need to pass in the pool account as the signer for the multisig, ie:

    let ix = mint_to(
        &ctx.accounts.token_program,
        ctx.accounts.mint.key(),
        ctx.accounts.to.key(),
        ctx.accounts.multisig.key(),
        &[&ctx.accounts.pool.key()],
        amount,
    )?;

This will properly mark the pool account as a required signer, and allow invoke_signed to work.

1
  • It's not working like this I already tried... Checked a bunch of alternatives like "re marking" accounts in ix and accounts without luck... Like: ``` all_acc = ctx.accounts.to_account_infos() .iter() .map(|acc| { let mut acx = acc.clone(); if acx.key == &self.pool.key() { acx.is_signer = true; ... ```
    – Shelvak
    Commented Mar 14 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.