Skip to content

Commit

Permalink
Sync with oracle contract update, and remove airswap plugin. (#48)
Browse files Browse the repository at this point in the history
* improvement, don't use block number of round event, it will be removed.

* improvement, sync the changes of oracle protocol contract.

* remove airswap plugin.
  • Loading branch information
Jason-Zhangxin-Chen authored Feb 11, 2025
1 parent 93a670a commit a93c2b8
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 2,789 deletions.
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.

.PHONY: mkdir oracle-server conf-file e2e-test-stuffs forex-plugins dex-plugins amm-plugins cex-plugins autoracle test e2e_test clean lint dep all
.PHONY: mkdir oracle-server conf-file e2e-test-stuffs forex-plugins amm-plugins cex-plugins autoracle test e2e_test clean lint dep all

LINTER = ./bin/golangci-lint
GOLANGCI_LINT_VERSION = v1.62.0 # Change this to the desired version
Expand Down Expand Up @@ -78,9 +78,8 @@ e2e-test-stuffs:
go build -o $(E2E_TEST_PRD_PLUGIN_DIR)/binance $(PLUGIN_SRC_DIR)/binance/binance.go
chmod +x $(E2E_TEST_PRD_PLUGIN_DIR)/binance

# build amm and dex plugins for e2e test.
# build amm plugin for e2e test.
go build -o $(E2E_TEST_CRYPTO_PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/uniswap_usdcx/crypto_uniswap_usdcx.go
go build -o $(E2E_TEST_CRYPTO_PLUGIN_DIR)/crypto_airswap $(PLUGIN_SRC_DIR)/crypto_airswap/crypto_airswap.go
chmod +x $(E2E_TEST_CRYPTO_PLUGIN_DIR)/*

# build bakerloo simulator plugin for e2e test.
Expand Down Expand Up @@ -116,11 +115,6 @@ cex-plugins:
go build -o $(PLUGIN_DIR)/crypto_kraken $(PLUGIN_SRC_DIR)/crypto_kraken/crypto_kraken.go
chmod +x $(PLUGIN_DIR)/*

# dex plugins are not officially release yet.
dex-plugins:
go build -o $(PLUGIN_DIR)/crypto_airswap $(PLUGIN_SRC_DIR)/crypto_airswap/crypto_airswap.go
chmod +x $(PLUGIN_DIR)/*

# amm plugins are not officially release yet.
amm-plugins:
go build -o $(PLUGIN_DIR)/crypto_uniswap $(PLUGIN_SRC_DIR)/crypto_uniswap/uniswap_usdcx/crypto_uniswap_usdcx.go
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ confidenceStrategy: 0 # 0: linear, 1: fixed
#
# The crypto data plugins are used to fetch market prices for the crypto currency pairs: ATN-USDC, NTN-USDC, NTN-ATN and
# USDC-USD. USDC liquidity is bridged to the Autonity public testnet from the Polygon Amoy testnet via a bridge service.
# Out-the-box plugins for collecting ATN-USDC and NTN-USDC market data are available for UniSwap V2 and AirSwap protocols. NTN-ATN market price is derived from
# that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and NTN-USD prices are then submitted on-chain.
# To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin and `crypto_airswap` plugin in your plugin directory.
# Oracle server can then discover and load them. Configuring the `crypto_uniswap` and `crypto_airswap` plugin does not
# Out-the-box plugins for collecting ATN-USDC and NTN-USDC market data are available for UniSwap V2 and AirSwap protocols.
# NTN-ATN market price is derived from that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and NTN-USD
# prices are then submitted on-chain. To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin plugin in your plugin directory.
# Oracle server can then discover and load them. Configuring the `crypto_uniswap` plugin does not
# require an API key, it is an open and free data source of a standard EVM RPC websocket service endpoint. The
# end user can connect to specific EVM RPC endpoint base on the blockchain which hosts the uniswap and airswap contracts.
# end user can connect to specific EVM RPC endpoint base on the blockchain which hosts the uniswap contract.

# USDC-USD prices are required by the protocol to convert the ATN-USDC and NTN-USDC to ATN-USD and NTN-USD. This enables
# the reporting of ATN and NTN prices in USD to the ASM. Three plugins are implemented to source the USDC-USD datapoint
Expand Down
12 changes: 6 additions & 6 deletions config/config_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ confidenceStrategy: 0 # 0: linear, 1: fixed
#
# The crypto data plugins are used to fetch market prices for the crypto currency pairs: ATN-USDC, NTN-USDC, NTN-ATN and
# USDC-USD. USDC liquidity is bridged to the Autonity public testnet from the Polygon Amoy testnet via a bridge service.
# Out-the-box plugins for collecting ATN-USDC and NTN-USDC market data are available for UniSwap V2 and AirSwap protocols. NTN-ATN market price is derived from
# that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and NTN-USD prices are then submitted on-chain.
# To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin and `crypto_airswap` plugin in your plugin directory.
# Oracle server can then discover and load them. Configuring the `crypto_uniswap` and `crypto_airswap` plugin does not
# require an API key, it is an open and free data source of a standard EVM RPC websocket service endpoint. The
# end user can connect to specific EVM RPC endpoint base on the blockchain which hosts the uniswap and airswap contracts.
# Out-the-box plugins for collecting ATN-USDC and NTN-USDC market data are available for UniSwap V2 and AirSwap protocols.
# NTN-ATN market price is derived from that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and
# NTN-USD prices are then submitted on-chain. To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin in your plugin directory.
# Oracle server can then discover and load them. Configuring the `crypto_uniswap` plugin does not require an API key,
# it is an open and free data source of a standard EVM RPC websocket service endpoint. The end user can connect to specific
# EVM RPC endpoint base on the blockchain which hosts the uniswap contract.

# USDC-USD prices are required by the protocol to convert the ATN-USDC and NTN-USDC to ATN-USD and NTN-USD. This enables
# the reporting of ATN and NTN prices in USD to the ASM. Three plugins are implemented to source the USDC-USD datapoint
Expand Down
11 changes: 5 additions & 6 deletions config/oracle_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ confidenceStrategy: 0 # 0: linear, 1: fixed
# The crypto data plugins are used to fetch market prices for the crypto currency pairs: ATN-USDC, NTN-USDC, NTN-ATN and
# USDC-USD. USDC liquidity is bridged to the Autonity public testnet from the Polygon Amoy testnet via a bridge service.
# Out-the-box plugins for collecting ATN-USDC and NTN-USDC market data are available for UniSwap V2 and AirSwap protocols.
# NTN-ATN market price is derived from that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and NTN-USD
# prices are then submitted on-chain. To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin and `crypto_airswap`
# plugin in your plugin directory. Oracle server can then discover and load them. Configuring the `crypto_uniswap` and
#`crypto_airswap` plugin does not require an API key, it is an open and free data source of a standard EVM RPC websocket
# service endpoint. The end user can connect to specific EVM RPC endpoint base on the blockchain which hosts the uniswap
# and airswap contracts.
# NTN-ATN market price is derived from that market data, and USDC pricing is converted to USD. ATN-NTN, ATN-USD, and
# NTN-USD prices are then submitted on-chain. To retrieve ATN and NTN prices, put the `crypto_uniswap` plugin in your plugin directory.
# Oracle server can then discover and load them. Configuring the `crypto_uniswap` plugin does not require an API key,
# it is an open and free data source of a standard EVM RPC websocket service endpoint. The end user can connect to specific
# EVM RPC endpoint base on the blockchain which hosts the uniswap contract.

# USDC-USD prices are required by the protocol to convert the ATN-USDC and NTN-USDC to ATN-USD and NTN-USD. This enables
# the reporting of ATN and NTN prices in USD to the ASM. Three plugins are implemented to source the USDC-USD datapoint
Expand Down
2 changes: 1 addition & 1 deletion contract_binder/contract/IOracle.abi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_height","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_votePeriod","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string[]","name":"_symbols","type":"string[]"},{"indexed":false,"internalType":"uint256","name":"_round","type":"uint256"}],"name":"NewSymbols","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_participant","type":"address"},{"indexed":false,"internalType":"string","name":"_symbol","type":"string"},{"indexed":false,"internalType":"int256","name":"_median","type":"int256"},{"indexed":false,"internalType":"uint120","name":"_reported","type":"uint120"}],"name":"Penalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_voter","type":"address"},{"indexed":false,"internalType":"int256[]","name":"_votes","type":"int256[]"}],"name":"Voted","type":"event"},{"inputs":[{"internalType":"uint256","name":"_ntnRewards","type":"uint256"}],"name":"distributeRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"finalize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNewVoters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_round","type":"uint256"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"getRoundData","outputs":[{"components":[{"internalType":"uint256","name":"round","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"success","type":"bool"}],"internalType":"struct IOracle.RoundData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSymbols","outputs":[{"internalType":"string[]","name":"_symbols","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVotePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVoters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_symbol","type":"string"}],"name":"latestRoundData","outputs":[{"components":[{"internalType":"uint256","name":"round","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"success","type":"bool"}],"internalType":"struct IOracle.RoundData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_symbols","type":"string[]"}],"name":"setSymbols","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_newVoters","type":"address[]"},{"internalType":"address[]","name":"_treasury","type":"address[]"},{"internalType":"address[]","name":"_validator","type":"address[]"}],"name":"setVoters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateVoters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_commit","type":"uint256"},{"components":[{"internalType":"uint120","name":"price","type":"uint120"},{"internalType":"uint8","name":"confidence","type":"uint8"}],"internalType":"struct IOracle.Report[]","name":"_reports","type":"tuple[]"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint8","name":"_extra","type":"uint8"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"}]
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_height","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_votePeriod","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string[]","name":"_symbols","type":"string[]"},{"indexed":false,"internalType":"uint256","name":"_round","type":"uint256"}],"name":"NewSymbols","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_participant","type":"address"},{"indexed":false,"internalType":"uint256","name":"_slashingAmount","type":"uint256"},{"indexed":false,"internalType":"string","name":"_symbol","type":"string"},{"indexed":false,"internalType":"int256","name":"_median","type":"int256"},{"indexed":false,"internalType":"uint120","name":"_reported","type":"uint120"}],"name":"Penalized","type":"event"},{"inputs":[{"internalType":"uint256","name":"_ntnRewards","type":"uint256"}],"name":"distributeRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"finalize","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNewVoters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_round","type":"uint256"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"getRoundData","outputs":[{"components":[{"internalType":"uint256","name":"round","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"success","type":"bool"}],"internalType":"struct IOracle.RoundData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSymbols","outputs":[{"internalType":"string[]","name":"_symbols","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVotePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVoters","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_symbol","type":"string"}],"name":"latestRoundData","outputs":[{"components":[{"internalType":"uint256","name":"round","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bool","name":"success","type":"bool"}],"internalType":"struct IOracle.RoundData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_symbols","type":"string[]"}],"name":"setSymbols","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_newVoters","type":"address[]"},{"internalType":"address[]","name":"_treasury","type":"address[]"},{"internalType":"address[]","name":"_validator","type":"address[]"}],"name":"setVoters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateVotersAndSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_commit","type":"uint256"},{"components":[{"internalType":"uint120","name":"price","type":"uint120"},{"internalType":"uint8","name":"confidence","type":"uint8"}],"internalType":"struct IOracle.Report[]","name":"_reports","type":"tuple[]"},{"internalType":"uint256","name":"_salt","type":"uint256"},{"internalType":"uint8","name":"_extra","type":"uint8"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Loading

0 comments on commit a93c2b8

Please sign in to comment.