# README
microservice-ethereum-application-server
Receives and processes logs for supported applications, then returns them to the worker with additional information attached.
Supported contracts:
- Uniswap V2
- Balancer V2 (Swap)
- OneInch
- LP V1
- LP V2
- Fixed Rate Swap
- Mooniswap
Integrating a new application
Update the list above with the name of the application! Then, there are two files/folders that need to be updated:
common/ethereum/applications/applications.go
Add Application<name>
to the Application Enum, and any relevant const values such as log topics.
Update GetApplicationFee
and GetApplicationTransferParties
to include the new application.
Expand the switch case in ClassifyApplicationLogTopic
to determine whether a given log corresponds to the application.
common/ethereum/applications/<application name>
Should contain functions necessary for supporting the application (finding fees, contract calls/ABI, etc.).
Environment variables
Name | Description |
---|---|
FLU_WORKER_ID | Worker ID used to identify the application in logging and to the AMQP queue. |
FLU_DEBUG | Toggle debug messages produced by any application using the debug logger. |
FLU_AMQP_QUEUE_ADDR | AMQP queue address connected to to receive and send messages down. |
FLU_SENTRY_URL | String that may be optionally set with a Sentry URL to log app. |
FLU_REDIS_ADDR | Hostname to connect to for the Redis (state) codebase. |
FLU_ETHEREUM_CONTRACT_ADDR | Address of the application contract. |
FLU_ETHEREUM_HTTP_URL | URL to use to chat to an Ethereum RPC node. |
FLU_ETHEREUM_UNDERLYING_TOKEN_NAME | Name of underlying token. Used to create user actions. |
FLU_ETHEREUM_UNDERLYING_TOKEN_DECIMALS | Underlying token decimals in place (18 for DAI, 6 for USDT and USDC, etc). |
FLU_ETHEREUM_APPLICATION_CONTRACTS | List of supported application contracts to calculate fees from. |
FLU_ETHEREUM_UTILITY_CONTRACTS | List of supported utility contracts tag transactions for utility mining. |
FLU_ETHEREUM_WORK_QUEUE | Name of queue to send server work down. |
FLU_ETHEREUM_NETWORK | Id of underlying network, used to create user actions. |
Building
make build
Testing
make test
Docker
make docker
# Constants
EnvApplicationContracts to list the application contracts to monitor.
EnvContractAddress is the Fluid token contract.
EnvEthereumWsUrl is the url to use to connect to the WS Geth endpoint.
EnvNetwork is the network ID, used to create user actions.
EnvServerWorkQueue to send serverwork down.
EnvUnderlyingTokenDecimals supported by the contract.
EnvUnderlyingTokenName is used to identify token in user actions.
EnvUtilityContracts to list the utility contracts to monitor and tag transactions.