sygmaprotocol / sygma-fee-oracle Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
feeOracle can be used on testnet for GMP
ChainBridge commit (or docker tag):
chainbridge-solidity version:
chainbridge-substrate version:
Go version:
Expand fee oracle API to support fee data requests where the destination chain is a substrate-based chain with deployed Sygma pallet.
length_fee
) when the user requests a generic call fee estimate with the substrate-based destination chain.Add specific tags for each service (Etherscan, Coinmarketcap...) to logs when the query is successfull and it fails (not 200).
Add custom Str() field to the logs with the tag for service.
Seems to be more correct to filter gas price by domainID instead of domain name which seems arbitrary and is not used anywhere else.
Will be a lot more crucial when we implement proper database support and currently we have to edit shared config names to match gas price domains instead of matching domain IDs which are always correct.
The Swagger API documentation is currently not automatically updated upon new releases. This results in the link in the README file pointing to v1.0.0 of the API, which is hardcoded. Even if we change the URL to point to the latest version, the Swagger docs will still show v1.0.0 as it is the last released version of swagger docs.
To resolve this issue, we should automate the release of new versions of the Swagger docs using a GitHub action. This will ensure that the latest version of the documentation is always available and up to date.
Related to #24. Avoid using domain names to match domains and assign gas price APIs per domain.
Also, remove custom polygonscan implementation as it is the same as Etherscan.
Currently, it limits future possibilites to resuse Etherscan implementations on networks outside of ethereum (there are many which have Etherscan supported) and it cannot match gas prices per domainID which will be important for proper database support.
Currently, we need to have a hardcoded mapping for resources on testnets for which we want to query values from APIs like coinmarketcap. The reason behind this is that price APIs are being queried with the token symbols, so we need to remap testnet token symbols to something that actually has a price.
The problem with this is that currently, we have a hardcoded remap inside code. My idea would be to add an additional work mode for fee oracle. Currently, fee oracle works in two modes:
After refactoring, it would have three different modes:
explorer link
https://moonbase.moonscan.io/
The fee oracle must make an RPC call to the substrate to fetch inclusion_fee
when providing a fee estimate for a bridging request to the substrate-based chain. Support should be added in a general way so that fee oracle can call arbitrary substrate RPC calls.
inclusion_fee
explorer link
https://moonbase.moonscan.io/
Move local config.yaml into env var
Read the data that is currently in config.yaml from env var
Make necessary changes in devops repo also
config.yaml file is removed
configuration data is read from env var
Fee oracle needs to be refactored so it supports the new shared configuration.
Expand endpoint from: /{version}/rate/from/{fromDomainID}/to/{toDomainID}/resourceid/{resourceID}
to something like this:
/{version}/rate/from/{fromDomainID}/to/{toDomainID}/resourceid/{resourceID}/gasLimit/{msgGasLimit}
Currently, SSM params are being fetched by hardcoded value
sygma-fee-oracle/config/config.go
Line 37 in 9863b4b
Having fee oracle periodically fetch shared configuration would enable us not to have downtime on fee oracle service.
Currently, fee oracle is using levelDB, but we should migrate to something that will scale better with the growing data set.
Ensure that communication toward DB is abstracted so we can always exchange it with another implementation.
Implement Datadog APM with support for API error rate, latency, requests per second.
https://docs.datadoghq.com/tracing/trace_collection/dd_libraries/go/?tab=containers
Update config.yaml
Update config.yaml so that is up to date with shared config(add additional config if necessary)
Update ecs in devops repo if necessary
devnet is working without errors
Add PHA asset support in fee oracle.
As PHA is supported on the marketplace, this change should be just a matter of expanding configuration, so information on PHA token price is periodically fetched and persisted.
Currently, fee oracle requires us to define all possible conversion pairs manually. This, paired with the format of this configuration property, makes it really hard to maintain this in any real production environment.
It would be ideal for removing this as a configuration property fully.
I see two approaches here:
To further facilitate these approaches, we can expand the shared configuration for each individual resource.
Add property feeType - "basic" / "oracle"
. This would mark all tokens that are supported by fee oracle
Currently, we are calculating rates for each defined pair and persisting it. We could parse shared config, extract tokens that are marked to use oracle, and then only fetch the value of each supported token (in $) and persist these values. Then, when someone requires specific pair, we just divide $ values to get the rate. This would significantly reduce complexity, as adding a new token to fee oracle requires us just to add one more query toward a service like coinmarketcap. The biggest con to this approach is that we are using $ price as a medium for calculating rate (but probably services like coinmarketcap are also using this under the hood).
Second approach would be to parse shared config, extract tokens that are marked to use oracle, and then query rates for all possible pairs between them. This approach removes the necessity for us to define all the pairs for fee oracle manually but still has this problem of rapidly increasing the number of queries as we start supporting new tokens.
cc: @freddyli7 @P1sar @mpetrun5, what do you think about this? I am leaning more toward the 1) option.
TBD
TBD
Instead of fetching each param separate from environment use something like viper (relayer has custom logic because of chain configs) to do that to remove ifology when fetching params.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.