-
Notifications
You must be signed in to change notification settings - Fork 0
Pebble manager
Pebble manager is responsible for direct blockchain interaction with the Pebble (PBL) contract.
The source of contract that was used during development is located in:
contracts/Pebble.sol
- This contract is exactly the same as the live one, except for two things - check the notes below
build/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 an 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 work with the pebble contract that is in the repository and not the live contract, because there's a specific method in the development contract that does not exist in the live one.