# Actions

This page lists all actions on the dapp.fusion contract, including their descriptions and a list of the parameters for each action.

## Quick Links

[#addadmin](#addadmin "mention")

[#addcpucntrct](#addcpucntrct "mention")

[#claimaslswax](#claimaslswax "mention")

[#claimgbmvote](#claimgbmvote "mention")

[#claimrefunds](#claimrefunds "mention")

[#claimrewards](#claimrewards "mention")

[#claimswax](#claimswax "mention")

[#clearexpired](#clearexpired "mention")

[#compound](#compound "mention")

[#createfarms](#createfarms "mention")

[#init](#init "mention")

[#inittop21](#inittop21 "mention")

[#instaredeem](#instaredeem "mention")

[#liquify](#liquify "mention")

[#liquifyexact](#liquifyexact "mention")

[#reallocate](#reallocate "mention")

[#redeem](#redeem "mention")

[#removeadmin](#removeadmin "mention")

[#reqredeem](#reqredeem "mention")

[#rmvcpucntrct](#rmvcpucntrct "mention")

[#rmvincentive](#rmvincentive "mention")

[#setfallback](#setfallback "mention")

[#setincentive](#setincentive "mention")

[#setpolshare](#setpolshare "mention")

[#setrentprice](#setrentprice "mention")

[#stake](#stake "mention")

[#stakeallcpu](#stakeallcpu "mention")

[#sync](#sync "mention")

[#unstakecpu](#unstakecpu "mention")

[#updatetop21](#updatetop21 "mention")

### addadmin

> Adds a new admin wallet into the config table. Admin wallets are able to call certain actions that don't pose any risk to user funds, but are sensitive enough that they should not be able to be called by random wallets. Requires auth of this contract.

| Parameter      | Type | Description                                           |
| -------------- | ---- | ----------------------------------------------------- |
| admin\_to\_add | name | The WAX address of the admin to be added to the table |

### addcpucntrct

> Adds a new CPU contract to the config table. CPU contracts are the contracts that funds are sent to when staking/renting WAX to users (or the fallback\_cpu\_receiver). Requires auth of this contract.

| Parameter         | Type | Description                                                  |
| ----------------- | ---- | ------------------------------------------------------------ |
| contract\_to\_add | name | The WAX address of the CPU contract to be added to the table |

### claimaslswax

> Allows an sWAX holder to claim their claimable\_wax, and have it converted to lsWAX in a single transaction. Requires auth of the user with the claimable balance.

| Parameter       | Type  | Description                                             |
| --------------- | ----- | ------------------------------------------------------- |
| user            | name  | The wallet address of the user signing the transaction  |
| minimum\_output | asset | The minimum amount of lsWAX the user expects to receive |

### claimgbmvote

> Claims voting rewards from the CPU contract passed to the action. Voting rewards are automatically sent back to the main contract and added to the revenue\_awaiting\_distribution bucket. Can be called by anyone.

| Parameter     | Type | Description                                                          |
| ------------- | ---- | -------------------------------------------------------------------- |
| cpu\_contract | name | The WAX address of the CPU contract that has voting rewards to claim |

### claimrefunds

> Loops through the cpu\_contracts in the config table, and claims available refunds from the system contract if any are available. Can be called by anyone.

### claimrewards

> Allows a user to claim their claimable\_wax. Requires auth of the user with a claimable\_wax balance.

| Parameter | Type | Description                                               |
| --------- | ---- | --------------------------------------------------------- |
| user      | name | The WAX address of the user who is claiming their rewards |

### claimswax

> Allows a user to compound their sWAX by turning their claimable\_wax into more sWAX. Requires auth of the user.

| Parameter | Type | Description                                               |
| --------- | ---- | --------------------------------------------------------- |
| user      | name | The WAX address of the user who is claiming their rewards |

### clearexpired

> Allows a user to delete any of their expired redemption requests from the redeem\_requests table, freeing up their RAM. Requires auth of the user.

| Parameter | Type | Description                                               |
| --------- | ---- | --------------------------------------------------------- |
| user      | name | The WAX address of the user who is claiming their rewards |

### compound

> Claims any rewards available for swax\_currently\_backing\_lswax, and uses them to buy more sWAX to increase the backing of lsWAX. Can be called by anyone, once every 5 minutes.

### createfarms

> Takes any lsWAX from the state2 singleton's incentives\_bucket, and creates LP farms on Alcor. Farm allocations are in proportion to the poolId's parts\_to\_allocate / total parts of all pairs in the lpfarms table. Can be called by anyone.

### init

> Initializes the global singleton, rewards singlegon, and creates the initial epoch. Requires auth of this contract.

### inittop21

> Initializes the top21 singleton. Requires auth of this contract.

### instaredeem

> Allows users to instantly redeem their sWAX for liquid WAX instead of submitting a request and waiting 1-21 days. Incurs a 0.05% fee which goes to the protocol, and is only available if the amount of WAX in wax\_available\_for\_rentals is >= the amount of sWAX the user wants to redeem. Requires auth of the user.

| Parameter        | Type  | Description                                                     |
| ---------------- | ----- | --------------------------------------------------------------- |
| user             | name  | The WAX address of the user who wants to instaredeem            |
| swax\_to\_redeem | asset | The amount of sWAX that the user wants to redeem for liquid WAX |

### liquify

> Allows a user to convert their sWAX into lsWAX. Requires auth of the user.

| Parameter | Type  | Description                                      |
| --------- | ----- | ------------------------------------------------ |
| user      | name  | The WAX address of the user who wants to liquify |
| quantity  | asset | The amount of sWAX the user wants to liquify     |

### liquifyexact

> Allows a user to convert their sWAX into lsWAX, and also specify the minimum amount of lsWAX they expect to receive. While there is not actually any slippage/price impact incurred when liquifying, we decided it was a good idea to allow users to specify their minimum output in case they are trying to arbitrage on exchanges, and want to make sure they know exactly how much of an asset they are trading. Requires auth of the user.

| Parameter       | Type  | Description                                           |
| --------------- | ----- | ----------------------------------------------------- |
| user            | name  | The WAX address of the user who is calling the action |
| quantity        | asset | The amount of sWAX that the user wants to liquify     |
| minimum\_output | asset | The amount of lsWAX the user expects to receive       |

### reallocate

> If the most recent redemption window has ended, this action takes any unredeemed funds and reallocates them by recycling them back into the wax\_available\_for\_rentals pool. Can be called by anyone.

### redeem

> If a user has requested a redemption, and the redemption window for their request is currently active, they can call this action to claim the requested funds. Requires auth of the user.

| Parameter | Type | Description                                           |
| --------- | ---- | ----------------------------------------------------- |
| user      | name | The WAX address of the user who wants to redeem funds |

### removeadmin

> Removes an admin wallet from the config singleton. Requires auth of this contract.

| Parameter         | Type | Description                                   |
| ----------------- | ---- | --------------------------------------------- |
| admin\_to\_remove | name | The WAX address of the admin wallet to remove |

### reqredeem

> Allows a user to request a redemption so they can convert their sWAX into liquid WAX. Requires auth of the user.

| Parameter                         | Type  | Description                                                                                                                                                   |
| --------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| user                              | name  | The WAX address of the user who wants to request a redemption                                                                                                 |
| swax\_to\_redeem                  | asset | The amount of sWAX that the user wants to redeem                                                                                                              |
| accept\_replacing\_prev\_requests | bool  | Redemption requests will replace any previous redemption requests. If this is set to false, the transaction will fail unless the user has no pending requests |

### rmvcpucntrct

> Removes a CPU contract from the config singleton. Requires auth of this contract.

| Parameter            | Type | Description                                   |
| -------------------- | ---- | --------------------------------------------- |
| contract\_to\_remove | name | The WAX address of the CPU contract to remove |

### rmvincentive

> Removes an incentive from the lpfarms table. Requires auth of this contract.

| Parameter | Type      | Description                                            |
| --------- | --------- | ------------------------------------------------------ |
| poolId    | uint64\_t | The pool ID of the pair on Alcor's swap.alcor contract |

### setfallback

> Allows an admin wallet to set the fallback\_cpu\_receiver in the config table. Requires auth of the admin wallet calling the action.

| Parameter | Type | Description                                             |
| --------- | ---- | ------------------------------------------------------- |
| caller    | name | The WAX address of the admin wallet calling this action |
| receiver  | name | The WAX address of the new fallback\_cpu\_receiver      |

### setincentive

> Adds or updates an incentive in the lpfarms table. Requires auth of this contract.

| Parameter                 | Type      | Description                                                                        |
| ------------------------- | --------- | ---------------------------------------------------------------------------------- |
| poolId                    | uint64\_t | The pool ID of the pair that we want to incentivize on Alcor's swap.alcor contract |
| symbol\_to\_incentivize   | symbol    | The symbol of the token to create a farm for                                       |
| contract\_to\_incentivize | name      | The contract of the token to create a farm for                                     |
| percent\_share\_1e6       | uint64\_t | The 1e6 scaled percentage of liquidity rewards to allocate to this pair            |

### setpolshare

> Adjusts the percentage of revenue that goes to the protocol. This can only be set between 5-10%. Note that this does not affect the percentage that goes to users - it only changes the balance between protocol/ecosystem fund. Requires auth of this contract.

| Parameter  | Type      | Description                                                                     |
| ---------- | --------- | ------------------------------------------------------------------------------- |
| pol\_share | uint64\_t | The 1e6 scaled percentage of revenue that should go to protocol owned liquidity |

### setrentprice

> Allows an admin wallet to adjust the price for CPU rentals. Requires auth of the admin wallet calling the action.

| Parameter              | Type  | Description                                                   |
| ---------------------- | ----- | ------------------------------------------------------------- |
| caller                 | name  | The WAX address of the admin wallet calling this action       |
| cost\_to\_rent\_1\_wax | asset | The WAX amount to charge for each 1 WAX rented for 1 full day |

### stake

> This action is required before a user is able to mint sWAX. It stores a row for the user in the stakers table, for which they pay the RAM cost. Requires auth of the user.

| Parameter | Type | Description                                     |
| --------- | ---- | ----------------------------------------------- |
| user      | name | The WAX address of the user calling this action |

### stakeallcpu

> If the current time is >= the next\_stakeall\_time in the state singleton, this action will take any funds from the wax\_available\_for\_rentals bucket and stake them to the fallback\_cpu\_receiver, in the epoch that is next in the rotation. Can be called by anyone.

### sync

> Allows any admin wallet to sync the contract state with the current time. Requires auth of the admin wallet calling the action.

| Parameter | Type | Description                                            |
| --------- | ---- | ------------------------------------------------------ |
| caller    | name | The WAX address of the admin wallet calling the action |

### unstakecpu

> If the current time is >= the time\_to\_unstake of the epoch that started prior to the current epoch, this action can be called to unstake the CPU from that epoch, ensuring that the WAX is returned to the dapp contract in time for the redemption window. Can be called by anyone.

| Parameter | Type      | Description                                                                                                                                                                                           |
| --------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| epoch\_id | uint64\_t | By default (if you submit 0 as the epoch\_id), the contract will attempt to unstake CPU from the most recently ended epoch. You can override this behavior by specifying an epoch\_id to unstake from |
| limit     | int       | By default (if you submit 0 as the limit), the contract will process up to 500 rows when unstaking CPU. You can override this by specifying a limit                                                   |

### updatetop21

> If it has been >= 24 hours since the last time the top21 table was updated, anyone can call this action to sync the top21 table with the current state of the chain.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.waxfusion.io/smart-contracts/dapp.fusion/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
