Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme #92

Merged
merged 6 commits into from
Feb 19, 2024
Merged

Update readme #92

merged 6 commits into from
Feb 19, 2024

Conversation

zhongeric
Copy link
Collaborator

@zhongeric zhongeric commented Feb 15, 2024

new readme:

Relayer

Contracts that allow for the relaying of transactions to the UniversalRouter in exchange for ERC20 tokens. The contract ensures that UniversalRouter is called with the calldata encoded in the order and transfers tokens from the swapper to any specified recipients.

RelayOrderReactor

The RelayOrderReactor is responsible for validating RelayOrders, transferring input tokens and making any requested onchain calls. There is no additional verification performed after an order is filled, so it is crucial to encode any desired checks for balance or ownership into the calldata within the order.

This contract does not inherit the standard IReactor interface in UniswapX as the contract does not perform a callback to a filler. Fillers can execute orders by calling execute(SignedOrder calldata order, address feeRecipient) directly, passing in an order and the address which the order's fee should be sent to. For convenience, execute(SignedOrder calldata order) can also be called without the feeRecipient argument to direct all fees to the caller. Batch executes and permit + execute are enabled via built in multicall.

RelayOrder

Swappers generate Relay Orders to be submitted onchain. These orders have one static input, one dynamic fee, and calldata encoded for the UniversalRouter.

The Input in a RelayOrder is a static amount which is sent to a specific recipient signed by the swapper. For example, they would be sent to the UniversalRouter to perform a relayed swap.

The fee specified in a RelayOrder is sent directly to feeRecipient and can optionally increase in value linearly over the lifetime of the order. The actual amount transferred will be resolved at the time of filling.

Integrating as a filler

Deployment Addresses

Usage

# install dependencies
forge install

# compile contracts
forge build

# run unit tests
forge test

# setup hardhat
yarn && yarn presymlink && yarn symlink

# generate calldata for integration tests
yarn test

# setup .env
cp .env.example .env

# run integration tests
FOUNDRY_PROFILE=integration forge test

Audit

Bug Bounty

Copy link

github-actions bot commented Feb 15, 2024

Forge code coverage:

File % Lines % Statements % Branches % Funcs
script/DeployRelayOrderReactor.s.sol 100.00% (4/4) 100.00% (4/4) 100.00% (0/0) 50.00% (1/2)
src/base/Multicall.sol 100.00% (6/6) 100.00% (8/8) 100.00% (2/2) 100.00% (1/1)
src/lib/FeeEscalatorLib.sol 0.00% (0/15) 0.00% (0/19) 0.00% (0/8) 0.00% (0/4)
src/lib/InputLib.sol 0.00% (0/1) 0.00% (0/2) 100.00% (0/0) 0.00% (0/1)
src/lib/OrderInfoLib.sol 0.00% (0/1) 0.00% (0/2) 100.00% (0/0) 0.00% (0/1)
src/lib/RelayOrderLib.sol 85.71% (12/14) 84.21% (16/19) 75.00% (3/4) 80.00% (4/5)
src/reactors/RelayOrderReactor.sol 100.00% (10/10) 100.00% (13/13) 100.00% (4/4) 100.00% (3/3)
Total 32.71% (35/107) 30.99% (44/142) 50.00% (9/18) 27.66% (13/47)

Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits, feel free to not accept if u dont agree tho

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg!

@zhongeric zhongeric merged commit 53081e7 into main Feb 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants