uwu-oracle-proxy-v1-1-0

The uwu-oracle-proxy-v1-1-0 contract is responsible for storing and managing STX price data fetched from the oracle address. As a proxy, it allows the defined contract owner to update the oracle address and to freeze the ability to make further changes to the oracle address.

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.

is-proxy-frozen

(define-data-var is-proxy-frozen bool false)

A data variable that holds the proxy's frozen status, indicating whether the oracle address can be changed.

oracle-address

(define-data-var oracle-address principal tx-sender)

A data variable storing the oracle address responsible for updating the STX price in the oracle proxy.

stx-price

(define-data-var stx-price uint u0)

A data variable containing the STX price provided by the oracle address.

Public Functions

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

set-oracle-address

(define-public (set-oracle-address (address principal)))

A public function that allows the contract owner to update the oracle address responsible for providing STX price updates.

Parameter

Type

Description

address

principal

The new oracle address

freeze-proxy

(define-public (freeze-proxy))

A public function, callable by the contract owner, which permanently freezes the proxy. When frozen, the oracle address cannot be changed.

update-stx-price

(define-public (update-stx-price (price uint)))

A public function that can be called by the oracle address to update the stored STX price in the oracle proxy.

Parameter

Type

Description

price

uint

The updated STX price

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-oracle-address

(define-read-only (get-oracle-address))

A read-only function that returns the current oracle address authorized to update the STX price in the oracle proxy.

get-is-proxy-frozen

(define-read-only (get-is-proxy-frozen))

A read-only function that returns whether the proxy is frozen or not. When the proxy is frozen, the oracle address cannot be changed.

get-stx-price

(define-read-only (get-stx-price))

A read-only function that returns the most recent STX price stored in the proxy, which was sent by the oracle address.

Last updated