> For the complete documentation index, see [llms.txt](https://docs.uwu.cash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uwu.cash/developers/contracts-api.md).

# Contracts API

## Smart Contracts

{% hint style="info" %}
Documentation for the **sip-010-trait-ft-standard** contract is not provided, as it's a standard implementation of the well-documented [SIP-010 Fungible Token Standard](https://github.com/stacksgov/sips/blob/main/sips/sip-010/sip-010-fungible-token-standard.md)
{% endhint %}

* [**uwu-factory-v1-1-0:**](/developers/contracts-api/uwu-factory-v1-1-0.md) The core contract managing Vaults and the minting and burning of UWU
* [**uwu-oracle-proxy-v1-1-0:**](/developers/contracts-api/uwu-oracle-proxy-v1-1-0.md) The proxy contract for managing STX price data from an authorized oracle
* [**uwu-oracle-v1-1-3:**](/developers/contracts-api/uwu-oracle-v1-1-3.md) The contract responsible for providing STX price data
* [**xuwu-fee-claim-v1-1-0:**](/developers/contracts-api/xuwu-fee-claim-v1-1-0.md) The contract managing fees generated by the protocol
* [**uwu-token-v1-1-0:**](/developers/contracts-api/uwu-token-v1-1-0.md) The contract for the SIP-010 compliant UWU fungible token

## Units

All unit values passed or returned by methods use 6 decimal places. For example, 1 UWU is expressed as `u1000000`.

## Error Codes

<table data-header-hidden><thead><tr><th width="98">Code</th><th width="261">Error</th><th>Description</th></tr></thead><tbody><tr><td><strong>Code</strong></td><td><strong>Error</strong></td><td><strong>Description</strong></td></tr><tr><td>1001</td><td>ERR_NOT_AUTHORIZED</td><td>The specified principal is not authorized</td></tr><tr><td>1002</td><td>ERR_INVALID_AMOUNT</td><td>The amount parameter is invalid</td></tr><tr><td>2001</td><td>ERR_VAULT_NOT_FOUND</td><td>The specified Vault was not found</td></tr><tr><td>2002</td><td>ERR_VAULT_LIMIT</td><td>The specified principal has reached the maximum limit of 20 Vaults per principal at any given time</td></tr><tr><td>2003</td><td>ERR_VAULT_NOT_LIQUIDATED</td><td>The specified Vault is not liquidated</td></tr><tr><td>2004</td><td>ERR_VAULT_LIQUIDATED</td><td>The specified Vault is liquidated</td></tr><tr><td>3001</td><td>ERR_MINIMUM_DEBT</td><td>The specified Vault is below the minimum amount of debt</td></tr><tr><td>3002</td><td>ERR_MAXIMUM_DEBT</td><td>The specified Vault has the maximum amount of debt</td></tr><tr><td>3003</td><td>ERR_NONZERO_DEBT</td><td>The specified Vault has non-zero debt</td></tr><tr><td>3004</td><td>ERR_ZERO_DEBT</td><td>The specified Vault has zero debt</td></tr><tr><td>4001</td><td>ERR_PROXY_FROZEN</td><td>The oracle proxy is frozen</td></tr></tbody></table>

## Upgradability

UWU Protocol is designed with a strong emphasis on immutability and non-upgradability for the majority of its components. The `CONTRACT_OWNER` is a constant, representing the principal authorized to make specific parameter changes within the contracts it is defined in.

The `CONTRACT_OWNER` is specified in two contracts:

* [**uwu-oracle-proxy-v1-1-0**](/developers/contracts-api/uwu-oracle-proxy-v1-1-0.md)
* [**uwu-token-v1-1-0**](/developers/contracts-api/uwu-token-v1-1-0.md)

Its purpose is to allow for modifications to the oracle used and token metadata, with the latter not affecting the protocol itself as it pertains to off-chain information related to the protocol's tokens.

Due to the current lack of decentralized oracle providers on Stacks, UWU Protocol is temporarily relying on a trust-minimized oracle. This is the reason behind the upgradability of the oracle proxy. Once upgraded to a decentralized oracle provider, the oracle proxy will be permanently frozen.

The `CONTRACT_OWNER` cannot modify the core functionalities of other contracts, such as `uwu-factory-v1-1-0`. All other contracts are immutable and non-upgradable.

## Versioning

The versioning for UWU Protocol follows a three-digit structure (X.Y.Z), where:

* **First digit (X):** Represents a major change that requires redeployment of non-proxy contracts. Upgrading to a new major version implies a completely new system, operating separately from the previous one. Users can still interact with the previous release, even when a new major version is deployed
* **Second digit (Y):** Represents a minor change that also requires redeployment of non-proxy contracts. Similar to a major change, this update results in a new version of the system operating separately from the previous one
* **Third digit (Z):** Represents a minor change that does not require redeployment of core contracts. These updates may include changes such as a new oracle contract or the addition of new contracts that are optional and do not necessitate redeployment of core contracts

## License

The contracts used in UWU Protocol are licensed under the GNU General Public License v3.0 (GPLv3). For more information on the license terms and conditions, please refer to the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.html).
