1

I keep getting the following error:

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

which is related to the contract not having the users active key to sign the inline transaction on the users behalf, this I already know. My inline contract is basically identical to the rex contract but instead of eosio.token, it's using a similar custom token contract with it's transfer method, which is identical to the eosio.token contract.

However when I look at the rex contract's deposit function it is using an inline transaction to take tokens as a payment:

   /**
    * @brief Deposits core tokens to user REX fund
    *
    * @param owner - REX fund owner
    * @param amount - amount of tokens to be deposited
    */
   void system_contract::deposit( const name& owner, const asset& amount )
   {
      require_auth( owner );

      check( amount.symbol == core_symbol(), "must deposit core token" );
      check( 0 < amount.amount, "must deposit a positive amount" );
      // inline transfer from owner's token balance
      {
         token::transfer_action transfer_act{ token_account, { owner, active_permission } };
         transfer_act.send( owner, rex_account, amount, "deposit to REX fund" );
      }
      transfer_to_fund( owner, amount );
   }

What is the rex contract doing that allows it to remove tokens from the user in an inline transaction?

0

Adding eosio.code grants permission to send inline-actions to other contracts.

This will not allow you to transfer tokens from one account to another as long as you don't have the permission to do so.

The common approach to accept payments is to add a Custom Dispatcher

  • There really isn't enough info in the OP question to accurately answer what he needs. Though with EOS.CDT 1.6, you do not need to write a custom dispatcher as that logic is handled by properly declaring a notification listener to a method. medium.com/@eosio/…. The docs you linked are outdated – netuoso - EOS Titan Jul 25 '19 at 12:49
0

Can you share the whole request call? I think that you are missing the active key of the owner while trying to deposit tokens. The following line: require_auth( owner ); requires authorization of owner which is passed by the method but as I said, I think that you are missing the signature keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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