1

i want to write a small smart contract game where players will be able to send Characters (NFTs, atomicassets) into a battlefield. On that battlefield they have a chance to die. Which means that asset will be burned.

I know how the burning process works generally (https://github.com/pinknetworkx/atomicassets-contract/wiki/Actions#burnasset). But for the burnasset action the authorization of the Owner of the NFT is needed.

I know that I can check via require_auth( permission_level {X, Y } ) if the player has the required authorization. But is there a way that the user passes that authorization to the smart contract action?

If try to call the action with the given player name for the permission like:

  action(
      permission_level{player, "active"_n},
      "atomicassets"_n,
      "burnasset"_n,
      std::tuple{ player, assetId }
  ).send();

I get the following exception when calling my smart contract action:

transaction declares authority '{"actor":"<<player>>","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [{"actor":"<<smartContract>>","permission":"eosio.code"}], provided keys [], and a delay max limit of 3888000000 ms

And if I try to call the action with the smart contract for permission like:

  action(
      permission_level{get_self(), "active"_n},
      "atomicassets"_n,
      "burnasset"_n,
      std::tuple{ player, assetId }
  ).send();

I get the exception of missing authority of the player:

missing authority of <<player>>

Can anyone help me with that? Help is a lot appreciated.

Thanks in advance and greetings.

TLDR: Is there a way to give a smart contract action the permission to call an inline action with the authorization of the smart contract caller?

4
  • You can try asking the devs behind the standard here: t.me/atomicdevs
    – Nat
    Aug 22, 2021 at 15:55
  • Only the owner as you said can burn, and if you want to use the official atomic assets contract, you cannot modify it. Perhaps you can have the user transfer all items for battle to the battle contract, anything destroyed can be burnt by the battle contract then when the battle is over all remaining items are returned.
    – Nat
    Aug 22, 2021 at 15:58
  • yeah. Thats probably the only way. But wouldn't I have the same problem transferring? The I need the owners authorization to start a transfer.
    – Froggythep
    Aug 23, 2021 at 4:55
  • Yeah the users would need to transfer to the contract for the duration of the fight. Then you can send them back their NFTs that haven't been destroyed.
    – Nat
    Aug 23, 2021 at 16:07

1 Answer 1

1

As mentioned in the comments above it is currently not possible to burn those NFTs without changing the owner. Therefore a transfer is needed.

Your Answer

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

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