In the swayswap exchange contract, the TOKEN_ID_KEY is 0x0000000000000000000000000000000000000000000000000000000000000001
.
the token reserve can be read from storagewith the key.
// To get the reserve of the token
fn get_current_reserve(token_id: b256) -> u64 {
get::<u64>(token_id)
}
let token_reserve = get_current_reserve(get::<b256>(TOKEN_ID_KEY));
What does the fuel contract storage layout look like?
Why can the eth reserve and the other token’s reserve be read from the 0x00
and the0x01
storage slot? I thought the first storage slot stores the lp_token_supply
And what is the storage key of the lp_token_supply
?
storage {
lp_token_supply: u64 = 0,
deposits: StorageMap<(Address, ContractId), u64> = StorageMap {},
}