https://github.com/samuelagm/bidding-game
This project contains a smart contract that implements a bidding game, it also contains the golang service for API interaction
https://github.com/samuelagm/bidding-game
ethereum golang solidity-contracts
Last synced: 2 months ago
JSON representation
This project contains a smart contract that implements a bidding game, it also contains the golang service for API interaction
- Host: GitHub
- URL: https://github.com/samuelagm/bidding-game
- Owner: samuelagm
- Created: 2023-01-13T21:16:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-13T21:23:47.000Z (over 2 years ago)
- Last Synced: 2025-01-07T22:53:14.795Z (4 months ago)
- Topics: ethereum, golang, solidity-contracts
- Language: Go
- Homepage:
- Size: 256 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bidding Game
***
This project contains a smart contract that implements a bidding game, it also contains the golang service that does the following:
1. Serves endpoint for the following routes:
- `/getcommissions` returns accumulated commissions.
- `/getcurrentroundnumber` returns the latest bid round number.
- `/getbidat/:round` returns the winning bid at the specified round.
- `/getlastbid` returns the very latest bid.
- `/restartgame` restarts the game if time has elapsed.
- `/withdraw` allows the application withdraw commissions to it's wallet.
- `/paywiner/:round` pays the specified bid round winner.
2. Watches for smart contract events and logs them in json format
3. Tracks game state and restarts it when the game time elapses.### Prerequisites
1. Install npm, typescript and go dependencies
`npm install`
`go install`### ENV
`HOST=https://nodeapi.test.energi.network/v1/jsonrpc`
`WSS_HOST=wss://nodeapi.test.energi.network/ws`
`PRIVATE_KEY=...`
`CONTRACT=...`
`GAME_CHECK_INTERVAL=5m`### Tests
- `npx hardhat test`
- `PRIVATE_KEY=... go test ./...`### Execution
`go run main.go`