test
folder under the location of your contract go file and add tests there.erc20.go
is the contract implementation, token_init_test.go
holds some testing code which we explore later, and balanceOfuser1.json
holds the gamma-cli query payload, which is executed over the Orbs blockchain (gamma) and runs the test.token_init_test.go
we can see the following:gamma
package, which is the wrapping of gamma-cli inside go code. Using Start()
tells it to run gamma and wait for it to start, which can take several seconds to complete.Run()
function is exactly the same as you would execute from within the command line, as this is wrapping gamma execution directly.Transfer
event, as the ERC20 implementation performs a transfer in its _init()
function, and the ERC20 spec requires an event on transferuser1
is as expected. This is more of a sanity check on the deploy, to make sure that indeed the blockchain was updated correctly and that the contract initiated everything as expected. The payload inside balanceOf_user1.json
is:balanceOf
in contract OrbsERC20
is executed with the argument specified, which is the key for user1 (the user which was used to sign the deploy transaction)