NEWTON
Asked
8 months ago
81
views
0
I try to implement the function abs_value
of the package starkware.cairo.common.math
but i have this error
AssertionError: Expected main to contain the following arguments (in this order): ['range_check_ptr_ptr']. Found: ['range_check_ptr'].
I dont understand the error.
Can someone explain the error to me, why it happens ?
I am doing the challenge #17daysOfCairo of the day 3
Full code
%builtins range_check_ptr
from starkware.cairo.common.math import abs_value
func main{range_check_ptr}() {
let x = abs_value(-1);
return ();
}
1
Accepted answer
You actually don't need to import the range_check_ptr
but actually the range_check
built-in (check this link). Change your code to
%builtins range_check
from starkware.cairo.common.math import abs_value
func main{range_check_ptr}() {
let x = abs_value(-1);
return ();
}
and it should compile and run.
answered
8 months ago
How to divide felt in Cairo Lang using unsigned_div_rem?
Cairo Lang / StarkNet: What are Revoked references? What is alloc_locals?
How to use get_fp_and_pc in Cairo Lang?
What is the difference between tempvar/let in Cairo Lang? How to use allow_locals and local?
How to use Hints in Cairo Lang?
How to make recursive function in Cairo Lang?
How to make Bitwise operations in Cairo Lang using %builtins bitwise, bitwise_xor?
How do I connect my DAPP to Starknet-devnet using starknetjs?
What are steps to create a new contract using starknetjs?
How to modify keccak.cairo and/or packed_keccak.cairo to compute a 512bits keccak hash instead of 256 bits?
How to use Pedersen Hash in StarkNet / Cairo Language?
What Implicit arguments are in Cairo lang?
Are transpiled contracts only interactable with the warp cli?
How can I write contract memory with starknetjs?