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

Function

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