Categorygithub.com/fluidity-money/fluidity-appcmdmicroservice-ethereum-application-server
package
0.0.0-20240904073751-07d62d3164ce
Repository: https://github.com/fluidity-money/fluidity-app.git
Documentation: pkg.go.dev

# 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

NameDescription
FLU_WORKER_IDWorker ID used to identify the application in logging and to the AMQP queue.
FLU_DEBUGToggle debug messages produced by any application using the debug logger.
FLU_AMQP_QUEUE_ADDRAMQP queue address connected to to receive and send messages down.
FLU_SENTRY_URLString that may be optionally set with a Sentry URL to log app.
FLU_REDIS_ADDRHostname to connect to for the Redis (state) codebase.
FLU_ETHEREUM_CONTRACT_ADDRAddress of the application contract.
FLU_ETHEREUM_HTTP_URLURL to use to chat to an Ethereum RPC node.
FLU_ETHEREUM_UNDERLYING_TOKEN_NAMEName of underlying token. Used to create user actions.
FLU_ETHEREUM_UNDERLYING_TOKEN_DECIMALSUnderlying token decimals in place (18 for DAI, 6 for USDT and USDC, etc).
FLU_ETHEREUM_APPLICATION_CONTRACTSList of supported application contracts to calculate fees from.
FLU_ETHEREUM_UTILITY_CONTRACTSList of supported utility contracts tag transactions for utility mining.
FLU_ETHEREUM_WORK_QUEUEName of queue to send server work down.
FLU_ETHEREUM_NETWORKId 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.