Looking for a community member to design a bot that will demonstrate how to catch and sell fish for copper automatically on https://galleass.io.
Write a script that interfaces with the Galleass.io smart contracts currently deployed to Ropsten.
It should complete the following actions:
Purchase a Dogger from the Harbor if one is not currently in your inventory: This means calling the buyShip(bytes32 model) function in the Harbor contract. Please load the Harbor contract address dynamically by calling getContract(bytes32 name) in the Galleass contract. (The Galleass contract addresses can be found here: https://galleass.io/contracts.html)
Embark! (Put your Dogger into the Sea): This means calling the embark(uint256 shipId) function in the Sea contract.
Set sail toward the fish you wish to catch: This means calling setSail(bool direction) in the Sea contract. You can sail east (true) or west (false) depending on what fish are available to catch. You can parse events to determine which fish to catch.
First, look through all Fish events:
event Fish(bytes32 id, uint256 timestamp, address species, bytes32 image);
Then, remove any that have already been caught:
event Catch(address account, bytes32 id, uint256 timestamp, address species);
After sailing to the target fish, drop anchor: Your ship will sail a small distance with each block that is mined. You can get your location by calling shipLocation(address owner) in the Sea contract. When you are ready, call dropAnchor() in the Sea contract.
Cast your line using a random bait hash: Call the castLine(bytes32 baitHash) function in the Sea contract. The contract uses a commit/reveal scheme for randomness so you will need to generate a random SHA256 called the “reveal” and then hash the reveal as your baitHash.
Attempt to reel in the fish: Call the reelIn(bytes32 fish, bytes32 bait) function in the Sea contract. The bait is your “reveal” from the previous step.
If a fish is caught, sell it to the Fish Monger: Call the sellFish(address _species,uint256 _amount) function in the Fish Monger contract.
Return to the Harbor and Disembark: Set sail toward the harbor and call the disembark(uint256 shipId) function in the Sea contract when you are close enough. This will return the Dogger to your inventory.