# Smart Contract Functions

## Write Functions

### Staking Functions

1. **Stake:** This call takes in the user's desired number of AZERO to stake, transfers them from the user's wallet to the `Vault`. It then mints the appropriate number of sA0 tokens to the user's wallet.

### Unstaking Functions

1. **Request Unlock:** This takes the users's sA0 tokens and burns them, then sends the unlock request to the Validators.  This request is made by the user when they would like to start the unstaking process. The user specifies how many of their sA0 they would like to submit for AZERO in return.
2. **Delegate Withdraw Unbonded:** This tells each Validator to claim its unbonded amount, after that amount is made available to the Validator post-cooldown period. This sends all of the AZERO claimed by Validators back to the `Vault`.
3. **Redeem:** This method returns the user's available unstaked AZERO to their wallet from the Vault.
4. **Redeem with Withdraw:** This is a wrapper function that executes `delegateWithdrawUnbonded` and `redeem`.&#x20;

### Community Functions

1. **Compound:** Anyone on the network can make a `compound` call. This sets off a command from the `Vault` that makes it all the way down to the participating Validators to claim then re-bond the claimed AZERO. This enables Ike to benefit from compounding yield rewards, and can happen at most once per [Era](/overview/proof-of-stake-blockchains.md#staking-at-the-network-level). For more information on this, see [Community Actions](/the-ike-protocol/architecture/community-actions.md).

## Read-only Functions

Here is a non-exhausted list of commonly used functions.

1. **Get Fee Percentage:** Returns the current protocol[ Management Fee](/the-ike-protocol/dao-and-governance/protocol-management-fees.md).
2. **Get Incentive Percentage:** This returns the incentive fee given to those who execute the `compound` function.
3. **Get Shares from AZERO:** Returns the current value sA0 in terms of AZERO. This is constantly changing. For more information, see [Redemption Ratio](/the-ike-protocol/definitions.md).
4. **Get AZERO from Shares:** Returns the current value AZERO in terms of sA0. This is constantly changing. For more information, see [Redemption Ratio](/the-ike-protocol/definitions.md).

In addition, the `Vault` contract includes a number of basic *getter* methods for various values. For more information on these, see the contrat's interface on our Github.


---

# 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.ike.xyz/the-ike-protocol/architecture/smart-contract-functions.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.
