Skip to content

Commit

Permalink
[Q-6] Nitpicks
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaryash90 committed Sep 4, 2024
1 parent d5dc53e commit 5071642
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
## **Thirdweb Gateway Contract**
## **Thirdweb PayGateway Contract**

Thirdweb Gateway Contract is used as the entrypoint to thirdweb Pay for swaps and bridges.
Thirdweb PayGateway Contract is used as the entrypoint to thirdweb Pay for swaps and bridges.

This is a forwarder contract that forwards the swap providers transaction (LiFi, Decent, etc) to their contract. Thirdweb Gateway Contract has the following responsibilities:
This is a forwarder contract that forwards the swap providers transaction (LiFi, Decent, etc) to their contract. Thirdweb PayGateway Contract has the following responsibilities:

- Data Logging - this is essential for attribution and linking on-chain and off-chain data
- Fee Splitting - this allows us to split the fees in-flight and flexibility to change fees on a per client basis
- Data validation - this provides high-security as only thirdweb originated swaps with untampered data can use this contract
- exit point for contract calls - for LiFi, they can only guarantee toAmount for contract calls. This allows use to add a contract call to transferEnd that forwards the end funds to the user
- Stateless - this will be deployed on many different chains. We don’t want to have to call addClient, changeFee, addSwapProvider, etc on every single chain for every change. Therefore, this should not rely on data held in the state of the contract, but rather data passed in

[Gateway Reference](img/gateway.png)
[PayGateway Reference](img/gateway.png)

[Gateway With Transfer End](img/gateway-transfer-end.png)
[PayGateway With Transfer End](img/gateway-transfer-end.png)

## Features

- Event Logging
- TransferStart logs the necessary events attribution and link off-chain and on-chain through clientId and transactionId. We use bytes32 instead of string for clientId and transactionId (uuid in database) because this allows recovering indexed pre-image
- TransferEnd logs the transfer end in case of a contract call and can be used for indexing bridge transactions by just listening to our Thirdweb Gateway deployments
- TokenPurchaseInitiated logs the necessary events attribution and link off-chain and on-chain through clientId and transactionId. We use bytes32 instead of string for clientId and transactionId (uuid in database) because this allows recovering indexed pre-image
- TokenPurchaseCompleted logs the transfer end in case of a contract call and can be used for indexing bridge transactions by just listening to our Thirdweb PayGateway deployments
- FeePayout logs the fees distributed among the payees
- Fee Splitting
- supports many parties for fee payouts (we only expect us and client). It also allows for flexible fees on a per client basis
Expand Down
3 changes: 2 additions & 1 deletion src/PayGatewayModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract PayGatewayModule is EIP712, ModularModule, ReentrancyGuard {
*
* @param clientId ClientId of fee recipient
* @param payoutAddress Recipient address
* @param feeBPS The fee basis points to be charged. Max = 10000 (10000 = 100%, 1000 = 10%)
* @param feeAmount The fee amount to be paid to each recipient
*/
struct PayoutInfo {
bytes32 clientId;
Expand All @@ -68,6 +68,7 @@ contract PayGatewayModule is EIP712, ModularModule, ReentrancyGuard {
* @param expirationTimestamp The unix timestamp at which the request expires
* @param payouts Array of Payout struct - containing fee recipients' info
* @param forwardAddress Address of swap provider contract
* @param directTransfer Whether the payment is a direct transfer to another address
* @param data Calldata for swap provider
*/
struct PayRequest {
Expand Down

0 comments on commit 5071642

Please sign in to comment.