Commit Graph

87 Commits

Author SHA1 Message Date
Mohammad Amin Khashkhashi Moghaddam caca2da9e2
[price-pusher] Fix fee calculation on injective price pusher (#1007)
* Fix fee calculation on injective price pusher

We used an optimization to calculate the update fee based on the number of VAAs. This used to be true before the accumulator messages but now since both formats can be used, it is not obvious what the final fee would be. We can again try to optimize this code and reduce rpc calls by replicating the fee calculation logic from the smart contract, but for now we have rolled back to the unoptimized version.
2023-08-09 14:43:06 +02:00
Ali Behjati f1eeb94210 chore(eth): add scroll sepolia 2023-08-08 10:21:05 +03:30
Mohammad Amin Khashkhashi Moghaddam 272f3c1984
[contract-manager] Contract manager improvements (#1000)
* Use arrays instead of separate files per config

* Remove redundant endpoint on cosmwasm

* Add functions for upgrading the wormhole guardian sets

* Add wormhole contract management on evm and cosmwasm

* Add getter functions to check what sort of wormhole-deployment is used

* Reorganize contract manager package to be used via other packages

* Remove .env files per network and create a script that outputs the same file

* Use env variables in truffle config and output config in deployments

* Add executeUpdatePriceFeed to contract interface

* Add update pricefeed script

* Add saving functionality to store

* Save new contract configs automatically on Evm

* Make deploy script use the create-env.js internally

* Add utility function to get implementation address for Evm Proxy contracts

* Add shimmer testnet and replace evmos nunfunctional rpc

* New procedure for contract verification

* Update docs and remove duplicate configurations

* Remove shimmer configs

* Read default data source configs via contract manager

* Remove flattened contract before compiling/deploying
2023-08-07 14:13:29 +02:00
Ali Behjati 928027a270
chore(ethereum): deploy to base and syndr_testnet (#988) 2023-07-27 16:16:45 +03:30
Mohammad Amin Khashkhashi Moghaddam 92b295bd7a
[contract-manager] Cosmwasm contracts (#986)
* Add stable testnet contracts

* Fix bug in creating InjectiveExecutor from mnemonic

* Import only from root library

* Code verification on proposals for cosmwasm

* Minimal script to upload wasm codes

* Use the netwrok parameter for InjectiveChain executor instead of endpoints
2023-07-27 14:36:16 +02:00
Mohammad Amin Khashkhashi Moghaddam 31ad2b66a3
[contract-manager] Evm upgrades (#971)
* Add evm contract infos + minor improvements

* Throw error if chainId is invalid instead of using 0 silently

* Add wormholeChainName property for chains to use in governance actions

* Return all signatures upon proposal execution

* Unify privateKey schema for contract manager

* Implement getLastExecutedGovernanceSequence for all contract types

* Unify getPriceFeed interface between contracts

* Add update price feed for evm

* Adjust gasPrice on evm

* Add setter for datasources + add global chain for universal governance instructions

* Add utility function to execute arbitrary governance Vaa

* Remove redundant contract

* Better error message when gas is not enough on deployment

* Add aptos mainnet config

* Restore sui override of setFee governance message generation

* Export executeVaa function

* Address PR feedbacks

* More documentation and cleanup

* Remove INFURA_KEY logic and replace RPC endpoints with public ones

* EVMContract -> EvmContract, EVMChain -> EvmChain

* Make executeUpdatePriceFeed interface on cosmos similar to evm

* Better error message and more comment regarding gas
2023-07-25 08:14:31 +02:00
Mohammad Amin Khashkhashi Moghaddam fbd004f359
[xc-admin-frontend] Xc admin minor fixes (#968)
* Simplify refresh logic

* Bump wormhole-sdk version to include new chain names
2023-07-21 07:31:55 +02:00
Ali Behjati e63490be48
[eth] Add EOS network (#963) 2023-07-18 23:00:47 +03:30
Ali Behjati dcec1e9328
[eth] Finalize accumulator contract (#960) 2023-07-18 12:57:29 +03:30
Mohammad Amin Khashkhashi Moghaddam c732fcf586
Abolish xc governance sdk (#957)
* Replace xc-governance-sdk with xc_admin_common package

xc_admin_package was not using the CHAIN overrides declared in the governance-sdk so it was moved
to that package as well

* Replace xc-governance-sdk with xc_admin_common in other packages

* Remove the package and all of its references

* Fix tests

* Fix bug in GovernanceDataSourceTransfer encoding

* Rename all references to the old package

* Redeploy neutron_testnet contract with new chain id

* Move SetWormholeAddress to separate file
2023-07-17 15:24:54 +02:00
Mohammad Amin Khashkhashi Moghaddam 6c52eb6606
Contract manager upgrades (#952)
* Reuse xc_governance logic as much as possible in contract manager

Some functions in xc_governance were moved and refactored in order to become usable in
contract manager

* Add getBaseUpdateFee function for contract manager

* Add method for executeGovernanceInstructions

* Move up SetFee method to base class

* Add governance upgrade instruction

* Move governance payload generators out of contract classes into chain classes

* Switch from json to yaml for storage

* Remove test script for ci

* Add minimal aptos implementation

* Remove global Chains and Contracts variable and put them in DefaultStore

* Move aptos getClient function to Chain class

* Make denom field in baseUpdateFee optional and remove it from non-cosmwasm chains

* More documentation and minor fixes

* Add vaults storage

Although the set of vaults used in testing/production is just 2 it's a good idea to
not set them as predefined constants. So that for development purposes, we can create
new vaults and test them on the fly without changing too many places.
2023-07-14 12:14:24 +02:00
guibescos a77ee78d13
[eth] Deploy to mantle (#948)
* Deploy mantle

* Update pyth-evm-ks

* Update docs
2023-07-12 14:18:56 +01:00
Ali Behjati 2a4045504d
[eth] Add Linea goerli network (#947)
* [eth] Add Linea goerli network

* Add linea_testnet to eth/sdk/js
2023-07-11 11:15:22 +01:00
Ali Behjati bef4073b54
[price-service/client] Crash by default on WsError (#934)
* [price-service/client] Crash by default on WsError

* Update docker-compose files

* Update package versions again
2023-07-07 11:43:04 +03:30
Ali Behjati aa0e6fdf22
[eth] Add WEMIX network (#940)
* [eth] Add WEMIX network

* Fix pre-commit

* Remove unnecessary change

* Fix prettier

---------

Co-authored-by: Guillermo Bescos <g.bescos@yahoo.com>
2023-07-05 18:15:43 +01:00
Jayant Krishnamurthy 78917f6d65
Implement PythGovernanceAction (#906)
* blah

* rename workflow

* grrr

* ok progress

* ok progress

* ok progress

* grrr

* ok

* fix

* fix layout
2023-07-05 08:35:47 -07:00
Ryu 5e44fa4c95
[price_service] js client: getPriceFeed() (#922)
* [price_service] js client: getPriceFeed()

* Fix pre-commit

* Bump package versions

---------

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2023-06-28 18:28:37 +02:00
optke3 f3edf9c971
[sui 9/x] - hot potato fix for price updates (#805)
* state getters and setters, change Move.toml dependency to sui/integration_v2

* finish state.move

* add new line to pyth

* use deployer cap pattern for state module

* sui pyth

* update price feeds, dynamic object fields, Sui object PriceInfoObject

* register price info object with pyth state after creation

* sui governance

* some newlines

* error codes

* update and comment

* unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades)

* updates

* test_get_update_fee test passes

* fix test_get_update_fee and test_update_price_feeds_corrupt_vaa

* test_update_price_feeds_invalid_data_source

* test_create_and_update_price_feeds

* test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure

* test_update_cache

* update

* test_update_cache_old_update

* update_price_feeds_if_fresh

* comment

* contract upgrades start

* contract upgradeability

* update clock stuff

* edits

* use clone of sui/integration_v2 for stability

* make contract_upgrade::execute a public(friend) fun, remove clock arg

* E_INCORRECT_IDENTIFIER_LENGTH

* comment and edit

* add a single comment

* upgradeability fixes, other fixes

* update, migrate, state, pyth, setup, version_control

* upgradeability, governance, LatestOnly

* - state init_version, init_package_info
- governance and contract ugpradeability stuff

* make several functions public(friend), and friend the right modules in data_source.move

* add comment

* fix bug in from_u8, so that value <= TRANSFER_FEE

* rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES

* set_last_executed_governance_sequence

* set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001

* update README

* Update README.md

* Update README.md

* delete comments

* Update README.md

* Update README.md

* change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt

do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence.

* state::set_last_executed_governance_sequence

* rename error

* add newline to setup.move

* delete space

* Update README.md

* mark test module as well as some imports #[test_only] so sui move build works

* scripts for Pyth contract testing and deployment
remove required_version.move, as it is no longer being used for access control
make init_and_share_state a public(friend) function

* add build to Makefile

* init pyth ts script

* sui deploy and testing scripts

* contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update

* init_pyth.ts, registry.ts, create_price_feed.ts

* create price feeds

* deploy script and Move.toml

* some contract updates to compile with WH branch sui/mainnet
deployment script updates

* update README

* update readme

* rename TS scripts, edit readme

* add rev for wormhole dependency, edit README

* edit create_price_feed script

* - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier
- add test for price_info::get

* contract updates

* script edits

* contract upgrade in version_control.move and fix pyth_create_price_feed.ts

* add get_price_info_object_id function to pyth::state

* tests and build pass

* update scripts

* Pyth mainnet deploy, create all price feeds script

* clean up script imports

* add mainnet addresses to readme

* correct Pyth Mainnet addresses

* create price feeds on mainnet

* use git dependency in Move.toml

* edits

* delete required contracts

* get price info object ids

* get price info object IDs

* add json file containing price feed id to price info object id

* comment

* clean up scripts folder and imports

* more script clean up (comments)

* script updates

* hot potato stuff

* create_price_infos_hot_potato and update_single_price_feed

* don't create hot potato in batch price attestation

* latest only checks in Pyth.move

* delete tab

* edit

* run pre-commit hooks

* update price feeds script

* update_single_price_feed_logic, give hot potato contents type T copy and drop ability

* delete custom price attestation test

* get update multiple price feeds POC to work

* formatting via pre-commit

* update Move.toml so can run "sui move test", delete some error codes that were unused

* update update_price_feeds demo to auto-retrieve price info object ids

* update readme

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* don't print map, get prices after update

* script comments

* Update update_price_feeds.ts

* Update update_price_feeds.ts

* Update README.md

* script for token transfers

* testnet "mainnet simulation" deployment (with 19 mainnet guardians), and testnet deployment (with single testnet guardian)

* mainnet deploy

* update Move.toml

* Update README.md

* Update README.md

* edit readme

* Update README.md

* Update README.md

* Update README.md

* add PRICE_INFO_OBJECT map ID to README

* common questions

* edit comment

* update readme

* fix link

* add comments for update_single_price_feed

* edits

* Update README.md

* Update README.md

* Update README.md

* pre-commit run --all-files
2023-06-20 00:04:01 -04:00
Ali Behjati b8778c02d5
[price-service] Update readiness probe (#893)
* [price-service] Update readiness probe

This also refactors and explains the last changes on the liveness probe.

* Update comments

* Address review comments
2023-06-16 12:38:25 +02:00
Jayant Krishnamurthy 25c1ac2c33
[xc-admin] Contract management tool (#885)
* cleanup

* blah

* gr

* stuff

* hm

* hmm

* wtf

* ah fix this

* ok finally it does something

* ok

* hrm

* hrm

* blah

* blah
2023-06-15 07:17:20 -07:00
guibescos e1377e5627
[Xc admin cli] add and remove members (#887)
* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Comment

* Comment
2023-06-15 13:08:14 +01:00
Ali Behjati 75abeb1553
[price-service] Add minSymbols check to liveness (#882) 2023-06-13 14:40:34 +02:00
Ali Behjati 7dea578416
[xc-server] Reliability improvements (#875)
* [xc-server] Bugfix and improvements

* Address review comments
2023-06-11 14:58:36 +02:00
Ali Behjati 95ca9d1d92
[xc-admin] Add message buffer instructions (#869)
* [xc-admin] Add message buffer instructions

* Use coral-xyz/anchor

* Address feedbacks

* Address feedbacks
2023-06-09 19:56:40 +02:00
Ali Behjati 183081cc20
Expose pythnet message buffer idls (#865) 2023-06-09 14:10:28 +02:00
Ali Behjati bdc3fede24
[eth] Deploy to Kava (#859)
* [eth] Deploy to Kava

* [eth] Bump sdk/js package version

* [eth] Fix pre-commit
2023-06-07 15:29:03 +02:00
Daniel Chew f99f23c416
update price service sdk (#849)
* update price service sdk

* bump version

* fix test

* include slot

* bump price-service-client version

* bump all that uses price-service-client

* bump all that uses price-service-client
2023-05-29 20:18:29 +09:00
guibescos ddc0b48118
[Xc admin] frontend to use server (#832)
* Import axios

* Switch to axios

* Fix

* Error handling
2023-05-23 10:32:48 -05:00
Thomaz Leite ef6c9519be Bump price-service version 2023-05-22 10:08:05 -03:00
Thomaz Leite f1492ae3d5 Use native code for validating VAAs 2023-05-22 10:08:05 -03:00
Dev Kalra 1c529dd486
[price-pusher] sui (#825)
* sui pusher

* cache mapping

* typo

* remove comment

* add mainnet config

* update readme

* bump version
2023-05-20 00:05:34 +05:30
Ali Behjati e283b15d20
[price-service] Improve vaa validation (#814)
* [price-service/server] Improve Vaa Validation

* [price-service/server] Improve performance

* Update wormhole guardian version
2023-05-17 20:20:17 +02:00
guibescos e243e6734b
[Xc admin] proposer server (#816)
* Proposer server

* Add package-lock.json

* Add rpc as enviornment variables
2023-05-16 13:15:08 -05:00
Dev Kalra 3b03f9eddc
[cosmwasm] instantiate contracts on multiple chains (#799)
* instantiate contracts on multiple chains

* deploy to neurtron

* function not being used anymore

* rename file dir

* better logs

* wormhole guardian upgrade

* set default wormhole contract

* add all to stages to one file

* add extended chain config

* bug fix

* juno deployment

* removed unused parameter

* resolve bug add comments

* typo

* rename to vaa mainnet

* comment

* remove T

* hardcode checksum

* update download method comment

* update package-lock

* update package-json
2023-05-16 13:13:43 +05:30
Dev Kalra 3fc996d6f9
[price-pusher] support for aptos (#815)
* aptos price listener

* price pusher aptos

* add comment

* update package lock

* remove eslint disable comments

* bump version

* npm i at root

* update readme

* address feedback

* update readme

* json fix
2023-05-15 21:14:28 +05:30
Ali Behjati 1dbc592836
[eth] Fix oracle-swap example frontend bugs (#813)
* [eth] Fix oracle-swap example frontend bugs

* [eth] Fix build warnings

* remove test

* add passWithNoTests to amm example

---------

Co-authored-by: Daniel Chew <cctdaniel@outlook.com>
2023-05-11 12:53:50 +02:00
Ali Behjati 1d59e9052b
[tilt] Fix issues (#801) 2023-05-05 15:31:57 +02:00
Dev Kalra 079828f8ac
Wormhole stub (#789)
* add

* add sei to wormhole chains

* add wormhole code to the repo

* add lib to gitignore

* cosmwasm bug fix

* add tmp to gitignore

* no need for simulation

* add wormhole deployment stuff

* better comments

* resolve build errors

* trying a fix

* fix

* rename compiled code

* address feedback

* remove gitignore

* sei deployment

* complete sentences

* address comments
2023-05-03 20:48:00 +05:30
Ali Behjati f94dceb1bc
[eth] Add Pyth Accumulator (#776)
This PR adds the support WormholeMerkle accumulator message to the ethereum contract while still supporting the old message format. The code is not optimized yet and with more optimizations we can achieve a better gas usage. Currently based on the gas benchmark below it has a 18% improvement with a single price feed. Although the cost of updating 5 feeds in the same batch is higher than the current approach but in reality the chances that all 5 feeds be in the same batch is very low.
2023-05-03 16:08:53 +02:00
guibescos facc2b6ff3
Pin axios (#787) 2023-05-01 08:45:06 -05:00
guibescos 3e5600508b
Fix axios bug by downgrading, bump all dependents (#786) 2023-04-28 10:19:40 -05:00
guibescos f5d11c248d
Rename init price (#755)
* Rename init price

* Set exponent
2023-04-10 20:30:58 -05:00
Ali Behjati 85b9c80e2a
[eth] Add Canto mainnet (#751)
* [eth] Add Canto mainnet

This deployment also enables contract rewards on canto. Since the
changed code is only specific to the Canto network and is used only
in initialization, only the diff is added as a file.

* Remove ds store

* Add some doc to deploying.md
2023-04-07 17:49:01 +02:00
Ali Behjati 71da520647
[eth] Deploy to Conflux eSpace (#748) 2023-04-07 16:23:20 +02:00
guibescos e476199c2c
[xc-admin] Add pythtest-crosschain (#749)
* Add pythtest-crosschain

* Restore urls
2023-04-06 17:48:54 -05:00
Ali Behjati 2db5a26752
[eth] Deploy to testnet Mantle (#742) 2023-04-04 13:34:32 +02:00
Ali Behjati 111b0fa09f
[eth] Deploy to meter (#731)
* [eth] Deploy to meter testnet

* Add mainnet
2023-03-31 18:51:18 +02:00
Cinque McFarlane-Blake 38a8c2831a
[evm] Deploy on Canto Testnet (#725)
* [evm] Deploy on Canto Testnet

* Redeploy

* Address feedbacks

---------

Co-authored-by: Ali Behjati <bahjatia@gmail.com>
2023-03-29 19:15:08 +02:00
Ali Behjati 272f11aac2
[eth] Redeploy shimmer testnet (#724) 2023-03-28 10:11:56 +02:00
guibescos 8e8fcf133b
[xc-admin] Introduce the new UPGRADE_OPS_KEY (#716)
* Do it

* Cleanup
2023-03-23 17:03:27 -05:00