dashed-slug.net › Forums › Fiat Coin Adapter extension support › Setting Balance for Custom Token › Reply To: Setting Balance for Custom Token
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