Skip to content

Commit

Permalink
Remove trader (#204)
Browse files Browse the repository at this point in the history
* Trader removed

* Call attempt

* Committee check

* Env passing

* Fix merge

* Another fix

* Indent

* Entrypoint

* Optional payout address

* Payout address optional in script; linter
  • Loading branch information
maciejzelaszczyk authored Sep 3, 2024
1 parent 1c0fa67 commit 73d5db6
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 790 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ azero/artifacts/*
azero/types/
azero/contracts/drink-tests/resources/*
azero/contracts/drink-tests/src/wrappers/*
!azero/artifacts/router.json
block_latest.json

# half of the internet
Expand Down
16 changes: 1 addition & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -435,25 +435,11 @@ endif
ifeq ($(DOCKER_RELAYER_COPY_ADDRESSES),copy)
cp azero/addresses.json relayer/azero_addresses.json
cp eth/addresses.json relayer/eth_addresses.json
ifeq ($(NETWORK),testnet)
wget https://public-chain-contracts.s3.eu-central-1.amazonaws.com/common/addresses/testnet/testnet.json -O relayer/common_addresses.json
else ifeq ($(NETWORK),mainnet)
echo "Mainnet addresses for Common are not yet known"; exit 1
else ifeq ($(NETWORK),bridgenet)
echo "Bridgenet addresses for Common are not yet known"; exit 1
else ifeq ($(NETWORK),development)
echo "Local development network does not have common contracts deployed and cannot be used for Trader testing."
touch relayer/common_addresses.json
else
echo "Unknown network"; exit 1
endif
endif
cp azero/artifacts/most.json relayer/most.json
cp azero/artifacts/advisory.json relayer/advisory.json
cp azero/artifacts/token.json relayer/token.json
cp azero/external_artifacts/router.json relayer/router.json
cd relayer && docker build -t $(DOCKER_RELAYER_NAME) --build-arg COPY_ADDRESSES=$(DOCKER_RELAYER_COPY_ADDRESSES) .
rm -f relayer/azero_addresses.json relayer/eth_addresses.json relayer/common_addresses.json relayer/most.json relayer/advisory.json relayer/token.json relayer/router.json
rm -f relayer/azero_addresses.json relayer/eth_addresses.json relayer/most.json relayer/advisory.json

contract_spec.json: # Generate a a file describing deployed contracts based on addresses.json files
contract_spec.json: azero/addresses.json eth/addresses.json
Expand Down
130 changes: 50 additions & 80 deletions eth/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions eth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"author": "fbielejec",
"license": "MIT",
"dependencies": {
"@openzeppelin-4.5.0/contracts": "npm:@openzeppelin/[email protected]",
"@openzeppelin/contracts": "=5.0.2",
"@openzeppelin/contracts-upgradeable": "=5.0.2",
"@openzeppelin-4.5.0/contracts": "npm:@openzeppelin/[email protected]"
"@openzeppelin/contracts-upgradeable": "=5.0.2"
},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
Expand All @@ -18,7 +18,7 @@
"@polkadot/api": "^10.11.2",
"child_process": "^1.0.2",
"dotenv": "^16.3.1",
"hardhat": "^2.19.0",
"hardhat": "^2.22.8",
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"solhint": "^4.1.1",
Expand Down
3 changes: 0 additions & 3 deletions relayer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ ARG COPY_ADDRESSES=copy
FROM ubuntu:jammy-20231211.1 as build_copy
ONBUILD COPY ./azero_addresses.json /usr/local/contracts/azero_addresses.json
ONBUILD COPY ./eth_addresses.json /usr/local/contracts/eth_addresses.json
ONBUILD COPY ./common_addresses.json /usr/local/contracts/common_addresses.json

FROM ubuntu:jammy-20231211.1 as build_no_copy
ONBUILD RUN echo "Contract addresses are not copied"
Expand All @@ -26,7 +25,5 @@ RUN chmod +x /usr/local/bin/entrypoint.sh

COPY ./most.json /usr/local/most.json
COPY ./advisory.json /usr/local/advisory.json
COPY ./token.json /usr/local/token.json
COPY ./router.json /usr/local/router.json

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
47 changes: 3 additions & 44 deletions relayer/relayer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,50 +43,6 @@ pub struct Config {
#[arg(long, use_value_delimiter = true, value_delimiter = ',')]
pub blacklisted_requests: Option<Vec<H256>>,

/// Whether to include trading component that makes periodic swaps from A0 -> Ethereum
#[arg(
long,
default_value = "false",
requires("router_address"),
requires("azero_wrapped_azero_address"),
requires("azero_ether_address")
)]
pub run_trader_component: bool,

/// Trader component will always keep this + current base_fee in the guardians balance and will only sell the surplus
///
/// Defaults to 1000 AZERO
#[arg(long, default_value = "1000000000000000")]
pub eth_to_azero_relaying_buffer: u128,

/// Trader component will bridge azero wETH after the balance exceeds this amount
///
/// Defaults to 0.1 ETH
#[arg(long, default_value = "100000000000000000")]
pub bridging_threshold: u128,

/// Trader component will claim rewards when they exceed this value
///
/// Defaults to 10 AZERO
#[arg(long, default_value = "10000000000000")]
pub reward_withdrawal_threshold: u128,

#[arg(long)]
pub router_address: Option<String>,

#[arg(long, default_value = "../azero/external_artifacts/router.json")]
pub router_metadata: String,

/// Ethereum PSP22 token on the AlephZero
#[arg(long)]
pub azero_ether_address: Option<String>,

#[arg(long, default_value = "../azero/artifacts/token.json")]
pub azero_ether_metadata: String,

#[arg(long)]
pub azero_wrapped_azero_address: Option<String>,

#[arg(long, use_value_delimiter = true, value_delimiter = ',')]
pub advisory_contract_addresses: Option<Vec<String>>,

Expand Down Expand Up @@ -141,6 +97,9 @@ pub struct Config {
#[arg(long, default_value = "100")]
pub sync_step: u32,

#[arg(long)]
pub payout_address: Option<String>,

#[arg(long, default_value = "redis://127.0.0.1:6379")]
pub redis_node: String,

Expand Down
Loading

0 comments on commit 73d5db6

Please sign in to comment.