Skip to content

Commit

Permalink
Fix typos (#180)
Browse files Browse the repository at this point in the history
* fix typos

* fix typos

* fix typo

* fix typo

* fix typos

* fix typo

---------

Co-authored-by: Tuan Tran <[email protected]>
Co-authored-by: Tien Nguyen <[email protected]>
  • Loading branch information
3 people authored Apr 22, 2024
1 parent f2241e6 commit 64e444b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ Fee-abs mechanism in a nutshell:

3. Swap accumulated ibc-token fee:

- The collected ibc-token users use for tx fee is periodically swaped back to customer chain's native token using osmosis.
- The collected ibc-token users use for tx fee is periodically swapped back to customer chain's native token using osmosis.

We'll goes into all the details now:
We'll go into all the details now:

#### Pulling `twap data` and update exchange rate

For this to work, we first has to set up an ibc channel from `feeabs` to `async-icq`. This channel set-up process can be done by anyone, just like setting up an ibc transfer channel. Once that ibc channel is there, we'll use that channel to ibc-query Twap data. Let's call this the querying channel.
For this to work, we first have to set up an ibc channel from `feeabs` to `async-icq`. This channel set-up process can be done by anyone, just like setting up an ibc transfer channel. Once that ibc channel is there, we'll use that channel to ibc-query Twap data. Let's call this the querying channel.

The process of pulling Twap data and update exchange rate :

![Diagram of the process of pulling Twap data and updating exchange rate](https://i.imgur.com/HJ9a26H.png "Diagram of the process of pulling Twap data and updating exchange rate")

Description :
For every `update exchange rate period`, at fee-abs `BeginBlocker()` we submit a `InterchainQueryPacketData` which wrapped `QueryArithmeticTwapToNowRequest` to the querying channel on the customer chain's end. Then relayers will submit `MsgReceivePacket` so that our `QueryTwapPacket` which will be routed to `async-icq` module to be processed. `async-icq` module then unpack `InterchainQueryPacketData` and send query to TWAP module. The correspone response will be wrapped in the ibc acknowledgement. Relayers then submit `MsgAcknowledgement` to the customer chain so that the ibc acknowledgement is routed to fee-abs to be processed. Fee-abs then update exchange rate according to the Twap wrapped in the ibc acknowledgement.
For every `update exchange rate period`, at fee-abs `BeginBlocker()` we submit an `InterchainQueryPacketData` which wrapped `QueryArithmeticTwapToNowRequest` to the querying channel on the customer chain's end. Then relayers will submit `MsgReceivePacket` so that our `QueryTwapPacket` which will be routed to `async-icq` module to be processed. `async-icq` module then unpack `InterchainQueryPacketData` and send query to TWAP module. The corresponding response will be wrapped in the ibc acknowledgement. Relayers then submit `MsgAcknowledgement` to the customer chain so that the ibc acknowledgement is routed to fee-abs to be processed. Fee-abs then update exchange rate according to the Twap wrapped in the ibc acknowledgement.

#### Handling txs with ibc-token fee

Expand All @@ -61,10 +61,10 @@ Fee-abstraction will use osmosis's Cross chain Swap (XCS) feature to do this. We

###### Reverse With Path-unwinding to get Ibc-token on Osmosis

- Create a ibc transfer message with a specific MEMO to work with ibc [``packet-forward-middleware``](https://github.com/strangelove-ventures/packet-forward-middleware) which is path-unwinding (an ibc feature that allow to automatic define the path and ibc transfer multiple hop follow the defined path)
- Create an ibc transfer message with a specific MEMO to work with ibc [``packet-forward-middleware``](https://github.com/strangelove-ventures/packet-forward-middleware) which is path-unwinding (an ibc feature that allows to automatic define the path and ibc transfer multiple hop follow the defined path)
- Ibc transfer the created packet to get the fee Ibc-token on Osmosis

Ex: When you sent STARS on Hub to Osmosis, you will get Osmosis(Hub(STARS)) which is different with STARS on Osmosis Osmosis(STARS). It will reverse back Osmosis(Hub(STARS)) to Osmosis(STARS):
Ex: When you sent STARS on Hub to Osmosis, you will get Osmosis(Hub(STARS)) which is different from STARS on Osmosis Osmosis(STARS). It will reverse back Osmosis(Hub(STARS)) to Osmosis(STARS):

![Diagram of the process of swapping accumulated ibc-tokens fee](https://i.imgur.com/D1wSrMm.png "Diagram of the process of swapping accumulated ibc-tokens fee")

Expand Down
2 changes: 1 addition & 1 deletion x/feeabs/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Fee-abs implementation:

- Fee-abs module imported to the customer chain.

The implememtation also uses Osmosis swap router and async-icq module which are already deployed on Osmosis testnet.
The implementation also uses Osmosis swap router and async-icq module which are already deployed on Osmosis testnet.
2 changes: 1 addition & 1 deletion x/feeabs/spec/03_epoch.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Epoch

The fee abstraction levegage the Osmosis `epoch` which is used to schedule the Inter-Blockchain Communication (IBC) send packet requests. These requests are for ``QueryArithmeticTwapToNowRequest` and `SwapIBCToken`.
The fee abstraction leverages the Osmosis `epoch` which is used to schedule the Inter-Blockchain Communication (IBC) send packet requests. These requests are for ``QueryArithmeticTwapToNowRequest` and `SwapIBCToken`.

The `QueryArithmeticTwapToNowRequest` packet is used to request Time-Weighted Average Price (TWAP) data from Osmosis network.

Expand Down
6 changes: 3 additions & 3 deletions x/feeabs/spec/07_ibc.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ This message is expected to fail if:
- `Receiver` is empty.
- `TimeoutHeight` and `TimeoutTimestamp` are both zero.

Feeabs module will send an ibc transfer message with a sepecific data in `Memo` field. This `Memo` field data will be used in Ibc transfer middleware on counterparty chain to swap the amount of ibc token to native token on Osmosis.
Feeabs module will send an ibc transfer message with specific data in `Memo` field. This `Memo` field data will be used in Ibc transfer middleware on counterparty chain to swap the amount of ibc token to native token on Osmosis.

# Host Chain

Host chain is the swap service provider that fee abstraction uses to swap a token for native fee. Currently, host chain is designed for Osmosis.

Fee Abstraction connection to host chain should always be kept alive unless specified FROZEN, as this is crucial to the normal function of fee abstraction.

A host chain config for fee abstraction will contains:
A host chain config for fee abstraction will contain:

```proto
enum HostChainFeeAbsStatus {
Expand All @@ -89,4 +89,4 @@ message HostChainFeeAbsConfig {
There are four status of fee abstraction connection to host chain:
* UPDATED: the connection is up - to - date.
* OUTDATED: the connection is out of date after failure to ibq query, or fail to cross - chain swap after 5 retries. Should be resumed after 30 mins.
* FROZEN: the connection is frozen, no further actions will be performed.
* FROZEN: the connection is frozen, no further actions will be performed.
4 changes: 2 additions & 2 deletions x/feeabs/spec/08_feeabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ SECURITY:
2. Query Twap price
* Query twap price can be done by either submitting a message, or periodically
* If failed to query TWAP, exponential backoff will kick in. The query retry will happen after [1, 2, 4, 8, 16] epochs.
* If exponential backoff reachs 4, the connection will be considered OUTDATED.
* If success, the connection will be considered UPDATED, reset exponential backoff
* If exponential backoff reaches 4, the connection will be considered OUTDATED.
* If success, the connection will be considered UPDATED, reset exponential backoff
6 changes: 3 additions & 3 deletions x/feeabs/spec/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Abstract

When making a transactions, usually users need to pay fees in native token, but `Feeabs` module enable users on any Cosmos chain which implements this module with IBC connections to pay fee using ibc token. When users use an ibc denom as fees, the ``FeeAbstrationMempoolFeeDecorator`` ante handler will check whether the chain support the transactions to be paid by that ibc denom. It will calculate the amount of ibc tokens equivalent to native token when users make a normal transaction based on Osmosis ``twap`` between ibc denom and native denom.
When making a transaction, usually users need to pay fees in native token, but the `Feeabs` module enables users on any Cosmos chain which implements this module with IBC connections to pay fee using ibc token. When users use an ibc denom as fees, the ``FeeAbstrationMempoolFeeDecorator`` ante handler will check whether the chain supports the transactions to be paid by that ibc denom. It will calculate the amount of ibc tokens equivalent to native token when users make a normal transaction based on Osmosis ``twap`` between ibc denom and native denom.

After that, the ``FeeAbstractionDeductFeeDecorate`` ante handler swaps ibc token for native token to pay for transaction fees. The accumulated ibc token will be swaped on Osmosis Dex every epoch.
After that, the ``FeeAbstractionDeductFeeDecorate`` ante handler swaps ibc token for native token to pay for transaction fees. The accumulated ibc token will be swapped on Osmosis Dex every epoch.

The `Feeabs` module fetches Osmosis [twap](https://github.com/osmosis-labs/osmosis/tree/main/x/twap) at the begin of every [epoch](01_concepts.md#Epoch) and swap all of ibc tokens left in the module to native token using `swap router` and `ibc hooks` on Osmosis.
The `Feeabs` module fetches Osmosis [twap](https://github.com/osmosis-labs/osmosis/tree/main/x/twap) at the beginning of every [epoch](01_concepts.md#Epoch) and swap all of ibc tokens left in the module to native token using `swap router` and `ibc hooks` on Osmosis.

## Contents

Expand Down

0 comments on commit 64e444b

Please sign in to comment.