Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

ads2 package

Functions

AdvertiserBalance

func AdvertiserBalance(addr string) string
Ask AI Claude ChatGPT

AdvertiserBalance returns the ugnot balance for an advertiser address.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.AdvertiserBalance()"

Result

ApproveTask

func ApproveTask(cur realm, taskId string, claimerAddr string)
Ask AI Claude ChatGPT

ApproveTask marks a task claim as approved. Only the task's advertiser or the admin may approve. Coin reward is handled server-side via the minter.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ApproveTask" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ApproveTask" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

ClaimRefEarnings

func ClaimRefEarnings(cur realm)
Ask AI Claude ChatGPT

ClaimRefEarnings moves the caller's accumulated referral earnings into a pending payout queue. The treasury server reads RefPendingClaim(), sends GNOT from the treasury wallet, then calls ClearRefClaim() to zero it.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ClaimRefEarnings" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ClaimRefEarnings" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

ClearRefClaim

func ClearRefClaim(cur realm, referrerAddr string)
Ask AI Claude ChatGPT

ClearRefClaim is called by the admin/treasury after disbursing GNOT to a referrer. Zeroes the pending payout entry.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ClearRefClaim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ClearRefClaim" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

DepositBid

func DepositBid(cur realm, ugnotAmount string)
Ask AI Claude ChatGPT

DepositBid credits the caller's advertiser balance with the declared ugnot amount. The caller must attach matching coins to the MsgCall (the VM holds them in the realm's address). The amount is passed explicitly so the realm can credit it without importing chain/banker.

Security: the treasury server MUST verify the on-chain balance before approving any campaign spend — it should call AdvertiserBalance() to cross-check the declared amount matches what was actually deposited.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "DepositBid" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "DepositBid" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

GetCampaign

func GetCampaign(campaignId string) string
Ask AI Claude ChatGPT

GetCampaign returns the JSON string for a single campaign, or "null".

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.GetCampaign()"

Result

GetTask

func GetTask(taskId string) string
Ask AI Claude ChatGPT

GetTask returns the JSON for a single task, or "null".

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.GetTask()"

Result

GetTaskClaim

func GetTaskClaim(taskId string, claimerAddr string) string
Ask AI Claude ChatGPT

GetTaskClaim returns the claim status string for a taskId+claimerAddr pair.

Params

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.GetTaskClaim(,)"

Result

ListCampaigns

func ListCampaigns(advertiserAddr string) string
Ask AI Claude ChatGPT

ListCampaigns returns a JSON array of campaigns submitted by advertiserAddr.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.ListCampaigns()"

Result

ListTasks

func ListTasks(advertiserAddr string) string
Ask AI Claude ChatGPT

ListTasks returns a JSON array of tasks submitted by advertiserAddr.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.ListTasks()"

Result

PendingReviews

func PendingReviews() string
Ask AI Claude ChatGPT

PendingReviews returns a JSON array of campaigns awaiting admin review.

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.PendingReviews()"

Result

RecordView

func RecordView(cur realm, campaignId string)
Ask AI Claude ChatGPT

RecordView bills the advertiser one bid_per_view for a player watching an ad. Deduplicated per (campaignId, callerAddr, UTC day). Splits 50% of the bid to the referrer if one is registered for the advertiser.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "RecordView" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "RecordView" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

RefEarnings

func RefEarnings(addr string) string
Ask AI Claude ChatGPT

RefEarnings returns the claimable referral earnings for an address.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.RefEarnings()"

Result

RefPendingClaim

func RefPendingClaim(addr string) string
Ask AI Claude ChatGPT

RefPendingClaim returns the pending payout amount for a referrer address. The treasury server calls this before sending GNOT.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.RefPendingClaim()"

Result

RegisterReferral

func RegisterReferral(cur realm, referrerAddr string)
Ask AI Claude ChatGPT

RegisterReferral permanently links the calling advertiser to a referrer. Each advertiser may register exactly one referrer; cannot be changed.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "RegisterReferral" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "RegisterReferral" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

Render

func Render(_ string) string
Ask AI Claude ChatGPT

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.Render()"

Result

ReviewCampaign

func ReviewCampaign(cur realm, campaignId string, decision string)
Ask AI Claude ChatGPT

ReviewCampaign approves or rejects a campaign. Approved campaigns transition to "active" and can receive views.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ReviewCampaign" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "ReviewCampaign" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

SelectAd

func SelectAd(viewerLevel int) string
Ask AI Claude ChatGPT

SelectAd returns the JSON of the winning campaign for the given viewer level, chosen by weighted auction (higher bid_per_view = proportionally more weight). Returns "null" if no eligible campaign exists.

NOTE: uses time.Now().UnixNano() % totalWeight as deterministic pseudo-random. Not cryptographic — sufficient for ad placement.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.SelectAd()"

Result

SetPaused

func SetPaused(cur realm, p bool)
Ask AI Claude ChatGPT

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SetPaused" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SetPaused" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

SubmitCampaign

func SubmitCampaign(cur realm, campaignJson string) string
Ask AI Claude ChatGPT

SubmitCampaign stores a campaign JSON and queues it for admin review. Returns the generated campaignId. Status is forced to "pending_review" regardless of what the client sends.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitCampaign" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitCampaign" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

SubmitTask

func SubmitTask(cur realm, taskId string, proofUrl string)
Ask AI Claude ChatGPT

SubmitTask records a player's proof-of-completion claim on a paid task.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitTask" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitTask" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

SubmitTaskDef

func SubmitTaskDef(cur realm, taskJson string) string
Ask AI Claude ChatGPT

SubmitTaskDef creates a new paid social task. Returns the taskId.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitTaskDef" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "onyx-1" -remote "https://rpc.onyx.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.onyx.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2" -func "SubmitTaskDef" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "onyx-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.onyx.testnets.gno.land" call.tx
  

TotalViews

func TotalViews(campaignId string) string
Ask AI Claude ChatGPT

TotalViews returns the total recorded view count for a campaign.

Param

Command

gnokey query vm/qeval -remote "https://rpc.onyx.testnets.gno.land" -data "gno.land/r/g138gdmwj6heduu3st796lw6qqdwylgaxf7ty5gz/ads2.TotalViews()"

Result