from cowboy_sdk import runtime gives a handler everything Cowboy offers beyond self.storage and self.sender. This page lists each function in one line; the SDK reference has the full signatures. Addresses can be an Address, a 0x string or 20 bytes. Amounts of CBY are in its smallest unit: 1 CBY is 1,000,000,000. Cowboy moves forward in numbered steps of about a second; the time and the step number below are the ones every machine agrees on for the current call.
The current call
The caller is
self.sender, not a runtime function.
State
Preferself.storage, which encodes values for you. These work on raw bytes:
Events
Money and tokens
CIP-20 covers tokens.
Timers
For a repeating schedule, use
@every from cowboy_sdk.
Other actors and jobs
Randomness and checks
Code
Don’t call
charge_gas(). Cowboy meters every handler for you; charge_gas charges more on top.
In tests
cowboy test runs on an in-memory host (cowboy_sdk.mock_host). State, the context, the owner, timers, calls (answered with CallMock), messages (mock_host.get_send_log()), transfers (mock_host.get_transfer_log()) and budget_left (chain.set_budget_left) work there. Tokens need a network. randomness works in cowboy run (Test your actor).
Go deeper
- CIP-6: Runtime module: what each function guarantees
- SDK reference: every signature, generated from the SDK