Starknet
On-chain Data Sources for Starknet
Some Starknet Data Sources convert between Cairo and Gate types. To assist in the conversion they receive a signature as a parameter, which includes info about the expected Cairo types, and will be converted to Gate types in the following way -
felt / felt252 / u8 / u16 /u32 / u64 / u128 / u256 / u512 / usize / ContractAddress / address / ClassHash /
integer
bool
boolean
tuple
tuple
named tuple / struct
tuple
Array
list
StarknetCall
Name: StarknetCall
Type: varies
Calls a function and gets the return value.
contract
integer
yes
signature
string
yes
params
tuple<varies>
depends on signature
block
integer
no
source callBalanceOf: StarknetCall<integer> {
contract: 2087021424722619777119509474943472645767659996348769578120564519014510906823,
signature: "function balanceOf(account: ContractAddress) returns (u256)",
params: tuple(1558378248635884316410409828526322547267712435327810386772478999281541266897),
};
source callName: string = StarknetCall<string> {
contract: 2087021424722619777119509474943472645767659996348769578120564519014510906823,
signature: "function name() returns (felt252)",
};
invariant {
description: "Starknet Call Eth Balance of",
condition: callBalanceOf == 1000,
};
invariant {
description: "Starknet Call Eth name",
condition: callName == "Ether",
};
StarknetEvents
Name: StarknetEvents
Type: list<tuple<varies>>
Get the parameters of all events with a specific signature emitted by a contract in the evaluated block.
contract
integer
yes
signature
string
yes
source events: list<tuple<
integer,
tuple<integer,integer,integer,integer,integer>,
tuple<tuple<integer,boolean>,boolean,integer,integer>,
tuple<tuple<integer,boolean>,tuple<integer,boolean>>,
integer,
tuple<integer,boolean>,
integer>> =
StarknetEvents {
contract: 158098919692956613592021320609952044916245725306097615271255138786123,
signature: "event Swapped(
locker: ContractAddress,
pool_key: (token0: ContractAddress, token1: ContractAddress, fee: u128, tick_spacing: u128, extension: ContractAddress),
params: (amount: (mag: u128, sign: bool), is_token1: bool, sqrt_ratio_limit: u256, skip_ahead: u128),
delta: (amount0: (mag: u128, sign: bool), amount1: (mag: u128, sign: bool)),
sqrt_ratio_after: u256,
tick_after: (mag: u128, sign: bool),
liquidity_after: u128)"
};
StarknetCalls
Name: StarknetCalls
Type: list<tuple<varies>>
Get the arguments of all function calls with a specific signature to a contract in the evaluated block
contract
integer
yes
signature
string
yes
Last updated