I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Setting Balance for Custom Token

dashed-slug.net Forums Fiat Coin Adapter extension support Setting Balance for Custom Token

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #5953

    When I create custom token on the Fiat Coin adapter setup, how can I periodically update the user balances that are returned by api_balance_filter()? Is there an API call to set the balance for a custom token?



    When you create a custom token using the Fiat Coin adapter, this balance works the same as the balance of any other type of coin: It is the sum of transactions affecting that user.

    The wallets_api_balance filter returns the current user’s balance. You do not need to periodically query this API, it is only for letting you know the total user’s balance.

    Could you please explain in more detail what you are trying to do?

    thank you


    I have a custom token defined on the Fiat adapter, with user values managed using a separate points tracking system. I want to have the values in the points system reflected in my custom token. Do I need to create a custom adapter to “wrap” the calls to pull information from the points system? Not clear to me how the defined custom token gets balances.


    OK, if you are trying to interface with another system such as MyCred, it will not be easy as some programming would be required. I have not tried this, as the scope of this plugin is cryptocurrencies, not point tokens.

    Instead of defining a token with the Fiat Coin Adapter, which is the easy part, you would have to implement your own Coin Adapter in PHP. A coin adapter is basically a piece of code that tells the plugin what happens when a user requests a withdrawal, and also lets the plugin know that a deposit was made.

    Before diving into the technical part of the problem, first decide on your design:

    – What does it mean for a user to withdraw your token? What would you expect to happen then?
    – What would trigger a deposit of your token? What event would you attach to in order to generate a deposit row for the DB?

    Also, keep in mind that the user balances are not just numeric amounts saved somewhere. Balances are sums of transaction amounts. You cannot simply “set” a balance, you can only add or subtract to it with a new transaction.

    Before attempting to implement anything I would recommend that you think about what a deposit and a withdrawal is.

    For an example of a simple coin adapter, you can study the now deprecated Litecoin adapter. Also, there are instructions in the documentation under the heading “Coin Adapter development” where the details are explained.

    Hope this makes things a bit clearer.

    with regards


    Thanks, it does – I suspected this might be more complex than I initially contemplated. Will think some more on this direction.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.