Pebble manager
Pebble manager is responsible for direct blockchain interaction with the Pebble (PBL) contract.
The source of contract that is used during development located in:contracts/Pebble.sol - The contract exactly the same as the live one, except two things, check notesbuild/contracts/Pebbles.json - Compiled, JSON version of the contract
Notes: Development contract expects founder address in the constructor, however live contract have it defined already. Also there's additional method for development purpose which is receivePbls.
getInstance()
Method that will return the existing or assign a new instance of Pebble contract. Pebble contract address should be defined in the js/config/index.js file.
Note: It would NOT deploy the contract itself, it will connect to existing already deployed instance.
createInstance()
Method will create and deploy new instance of Pebble contract to the blockchain network
approve(spender, player, value)
Method will approve specified amount of PBL that can be used by the user
spender - Address of a user who will be allowed to get PBLs
payer - Address of a user from who PBLs will be withdrawn
value - Amount of PBLs that should be transferred
balanceOf(address, callback)
Method will return the balance of PBLs for the specified address
address - wallet address of the user to get balance of
callback - expects the callback function that will be triggered after the balance is received
receivePbls(receiver)
This is a DEVELOPMENT method that will give PBLs to a user.
receiver - wallet address of the user who PBLs should be transferred to
Note: Keep in mind that this method will only works with the pebble contract that is in the repository and not the live contract, because there's a specific method in the development contracts that does not exist in live.