uwu-token-v1-1-0

The uwu-token-v1-1-0 contract is a fungible token implementation compatible with the SIP-010 standard. It functions as the primary token minted and burnt by the uwu-factory-v1-1-0 contract. The token is minted when users deposit STX as collateral into the uwu-factory-v1-1-0 contract and borrow UWU against it, and burnt when users deposit UWU.

Data Storage

These structures allow the contract to maintain its state, track information, and ensure data consistency throughout the contract's lifecycle.

CONTRACT_OWNER

(define-constant CONTRACT_OWNER tx-sender)

A constant representing the principal authorized to make parameter changes to the contract. The CONTRACT_OWNER can only issue changes to the oracle proxy (unless frozen) and update token metadata. The CONTRACT_OWNER is not authorized to perform any other actions.

token-uri

(define-data-var token-uri (string-utf8 256) u"")

A data variable that stores a link to the metadata associated with the token, including the token's name, symbol, description, and image.

Public Functions

These functions are accessible by external contracts or users, enabling interaction with the contract and state modification.

set-token-uri

(define-public (set-token-uri (uri (string-utf8 256))))

A public function, callable by the contract owner, that updates the token URI associated with the token.

Parameter

Type

Description

uri

string-utf8 256

The new token URI

transfer

(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34)))))

A public function that enables the transfer of a specified amount of tokens from the sender to a recipient, with an optional memo parameter.

Parameter

Type

Description

amount

uint

The amount to transfer

sender

principal

The principal sending the specified amount

recipient

principal

The principal receiving the specified amount

memo

optional buff 34

The optional memo

mint

(define-public (mint (amount uint) (account principal)))

A public function that mints a specified amount of tokens to a principal. This function can only be called by the uwu-factory-v1-1-0 contract.

Parameter

Type

Description

amount

uint

The amount to mint

account

principal

The principal set to receive the newly minted tokens

burn

(define-public (burn (amount uint) (account principal)))

A public function that burns a specified amount of tokens from a principal. This function can only be called by the uwu-factory-v1-1-0 contract.

Parameter

Type

Description

amount

uint

The amount to burn

account

principal

The principal from which tokens will be burnt

Private Functions

These functions are accessible only within the contract they are defined in, providing encapsulation and preventing external access to specific functionality.

This contract does not contain any private functions

Read-only Functions

These functions do not modify the contract's state and are used for querying or retrieving data. They can be called by external contracts or users but will not change the underlying state.

get-name

(define-read-only (get-name))

A read-only function that returns the token's name.

get-symbol

(define-read-only (get-symbol))

A read-only function that returns the token's symbol.

get-decimals

(define-read-only (get-decimals))

A read-only function that returns the token's number of decimals.

get-total-supply

(define-read-only (get-total-supply))

A read-only function that returns the current total supply of tokens.

get-balance

(define-read-only (get-balance (account principal)))

A read-only function that returns the token balance of a specified principal.

Parameter

Type

Description

account

principal

The principal to query

get-token-uri

(define-read-only (get-token-uri))

A read-only function that returns the token URI associated with the token.

Last updated