# Introducing the Spend Limit Authenticator

**URL:** <https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837>\
**Category:** General\
**Created:** [June 13, 2024, 1:35pm UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837 "2024-06-13T13:35:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnnyWyles](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.osmosis.zone/johnnywyles/32/3114_2.png) [@JohnnyWyles](https://forum.osmosis.zone/u/JohnnyWyles)\
**Post date:** [June 13, 2024, 1:35pm UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837/1 "2024-06-13T13:35:29Z")

</div>

The Spend Limit Authenticator is the first CosmWasm authenticator for Osmosis’s Smart Accounts functionality, offering enhanced security and control. As we continue to innovate, features like these will provide users with a seamless and secure trading experience.

The Spend Limit Authenticator lets users set a spend limit on their account.

When implemented in applications, spend limit authenticators should only be used as part of an **AllOf** authenticator with a **SignatureVerification** authenticator.

* * *

### Overview

Each Spend Limit Authenticator utilizes specific parameters called [SpendLimitParams](https://github.com/osmosis-labs/spend-limit-authenticator/blob/main/contracts/spend-limit/src/spend_limit/params.rs#L7-L16). These parameters are stored in the module state and passed to hooks to enforce the spend limit.

Global configurations and states are maintained in the [contract state](https://github.com/osmosis-labs/spend-limit-authenticator/blob/main/contracts/spend-limit/src/state.rs).

Tokens that have high liquidity will not reduce the spend limit total. (e.g OSMO ≤≥ ATOM) These tokens are decided when the contract is instantiated.

* * *

### Transaction Process

The authenticator checks if transaction amounts are within the spend limit. If the amount exceeds the limit, the transaction is rejected. Here’s how it works:

1. **Authentication** : Always marked as `Authenticated` in the `Authenticate` hook, with spend limit checks in the `ConfirmExecution` hook.
2. **Tracking Pre-Execution Balances** : The `Track` hook records pre-execution balances.
3. **Confirming Execution** : The `ConfirmExecution` hook checks post-execution balances, determining the transaction amount by the difference.
4. **Converting Spent Amount** : Amounts spent are converted into quoted denominations using TWAP prices.
5. **Enforcing Limits** : Transactions exceeding the spend limit are rejected; otherwise, they are accepted and spending is accumulated.

* * *

### Upload path

The spend limit authenticator contract will be uploaded using the Osmosis foundation key approved in [Proposal 775](https://daodao.zone/dao/osmosis/proposals/775).

* * *

### Github

For more details, visit our [GitHub repository](https://github.com/osmosis-labs/spend-limit-authenticator) and join the discussion in this forum.

Feel free to ask any questions or provide feedback below!

---

<div class="post-metadata">

**Author:** ![LeonoorsCryptoman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.osmosis.zone/leonoorscryptoman/32/208_2.png) [@LeonoorsCryptoman](https://forum.osmosis.zone/u/LeonoorsCryptoman)\
**Post date:** [June 13, 2024, 5:12pm UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837/2 "2024-06-13T17:12:56Z")

</div>

Sounds like a nice feature!

However, this part is confusing:

> [@JohnnyWyles](#):
>
> Tokens that have high liquidity will not reduce the spend limit total. (e.g OSMO ≤≥ ATOM) These tokens are decided when the contract is instantiated.

Why would high liquidity assets be excluded from reducing the spend limit total? Is the limit not meant for people to limit the allowed activity on their account?  
And as such, meaning that every trade should be included in the total?

---

<div class="post-metadata">

**Author:** ![JohnnyWyles](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.osmosis.zone/johnnywyles/32/3114_2.png) [@JohnnyWyles](https://forum.osmosis.zone/u/JohnnyWyles)\
**Post date:** [June 14, 2024, 8:03am UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837/3 "2024-06-14T08:03:36Z")

</div>

The spend limit isn’t a direct cap on flows, but a change in the net value of a wallet.  
I.e. You could trade $1000, incur a 0.2% fee ($2) and have $4998 left of a $5000 spend cap rather than $4000.

The main purpose of this is to avoid value leaving a user’s account through fees, high slippage and transfers - which swaps between high liquidity assets would barely impact.

---

<div class="post-metadata">

**Author:** ![LeonoorsCryptoman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.osmosis.zone/leonoorscryptoman/32/208_2.png) [@LeonoorsCryptoman](https://forum.osmosis.zone/u/LeonoorsCryptoman)\
**Post date:** [June 17, 2024, 6:39pm UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837/4 "2024-06-17T18:39:32Z")

</div>

Aaaaah, is there still the option to rename the feature?  
Since it is a bit confusing hahahaa

It is more a Fee-Limit Authenticator.  
Whereas a 5k swap with 20% fees / slippage and a 500k swap with 0.2% fee are treated the same if I understand the principle correct. Since in both cases there will be a $1k spend on fees/slippage, right?

Although I think the limit on fees paid is interesting, I think it is also have a feature which limits the tradeable amount of an address in general, because that would also be a feature which helps people to limit their exposure through trades (self protection in some cases) as well as an additional hurdle in case a wallet is compromised.

---

<div class="post-metadata">

**Author:** ![paddy\_mc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.osmosis.zone/paddy_mc/32/655_2.png) [@paddy\_mc](https://forum.osmosis.zone/u/paddy_mc)\
**Post date:** [June 27, 2024, 12:47pm UTC](https://forum.osmosis.zone/t/introducing-the-spend-limit-authenticator/2837/5 "2024-06-27T12:47:52Z")

</div>

Thanks for your input ❤

We’re renaming the feature loss protection.
