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

million/v0 package

Overview

Package million is a pay-per-pixel collaborative canvas: anyone can paint any pixel of a Width x Height grid in one of 15 colors by sending exactly Price() ugnot per pixel along with the call. Pixels can be repainted by anyone, for the same price. Payments are forwarded to the admin wallet as they arrive, and the admin paints for free.

The grid logic lives in gno.land/p/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/canvas/v0; this realm adds the payment guard, the owner controls and the read API used by the web client.

Functions

DirtyRows

func DirtyRows(since int64) string

DirtyRows lists the rows painted after version `since`, as "y,y,y" in ascending order. DirtyRows(0) is every row that was ever painted, which is all a fresh client needs to load: the others are blank.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.DirtyRows()"

Result

GetHeight

func GetHeight() int

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.GetHeight()"

Result

GetWidth

func GetWidth() int

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.GetWidth()"

Result

MaxBatchSize

func MaxBatchSize() int

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.MaxBatchSize()"

Result

Paint

func Paint(cur realm, x, y, color int)

Paint colors one pixel. Send exactly Price() ugnot (nothing for the admin).

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "Paint" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "Paint" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

PaintBatch

func PaintBatch(cur realm, pixels string)

PaintBatch colors up to MaxBatch pixels in one call. The argument is "x,y,color;x,y,color;...". Send exactly Price() * count ugnot (nothing for the admin).

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "PaintBatch" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "PaintBatch" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Painted

func Painted() int

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Painted()"

Result

Paints

func Paints() int64

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Paints()"

Result

Palette

func Palette() string

Palette returns the 16 palette colors as comma-separated CSS hex values, index 0 being the blank color.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Palette()"

Result

Pixel

func Pixel(x, y int) int

Pixel returns the color index at (x, y); 0 means never painted.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Pixel(,)"

Result

Price

func Price() int64

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Price()"

Result

Render

func Render(_ string) string

Render shows the game stats on gnoweb. The path is ignored.

Param

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Render()"

Result

Revenue

func Revenue() int64

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Revenue()"

Result

Rows

func Rows(from, to int) string

Rows returns rows [from, to) as one hex digit per pixel, Width digits per row, with no separators. Clients page through the grid with it.

Params

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Rows(,)"

Result

SetPrice

func SetPrice(cur realm, ugnot int64)

SetPrice changes the price per pixel, in ugnot. Zero makes painting free for everyone.

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "SetPrice" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "SetPrice" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

TransferOwnership

func TransferOwnership(cur realm, newOwner address)

TransferOwnership hands the admin role (payments, free painting and the owner controls) to newOwner.

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "TransferOwnership" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "TransferOwnership" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx
  

Version

func Version() int64

Version is the number of successful paint calls so far. Clients remember it and ask DirtyRows for what changed since.

Command

gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0.Version()"

Result

Withdraw

func Withdraw(cur realm, to address, amount int64)

Withdraw sends amount ugnot held by the realm to the given address. Payments are forwarded on arrival, so this only matters for coins sent to the realm outside of a paint call.

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/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "Withdraw" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/g1sw5xklxjjuv0yvuxy5f5s3l3mnj0nqq626a9wr/million/v0" -func "Withdraw" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx