;; Generated by NoCodeClarity
;; Inspired by NoCodeDevs
;; AI Preaudited
;; Define a variable to store the tip bot address, initialized to the contract deployer.
(define-data-var tip-bot-address principal tx-sender)
;; Public function to set a new tip bot address, only callable by the current tip bot address.
(define-public (set-tip-bot-address (new-address principal))
(begin
;; Ensure only the current tip bot address can update this value
(asserts! (is-eq tx-sender (var-get tip-bot-address)) (err u100))
;; Update the tip bot address to the new address provided by the authorized sender
;; The principal type ensures that new-address is a valid principal
(ok (var-set tip-bot-address new-address))))
;; Public function to tip STX to a recipient, only callable by the tip bot address.
(define-public (tip-stx (recipient principal) (amount uint))
(begin
;; Ensure only the current tip bot address can send tips
(asserts! (is-eq tx-sender (var-get tip-bot-address)) (err u101))
;; Transfer the specified amount of STX to the recipient
(stx-transfer? amount tx-sender recipient)))