Why do I always get this error in my rust flashloan code? -->…
Jump to turn (9)
- 1Why do I always get this error in my rust flashloan code? --> /Users/robertmccor
- 2How to do that?
- 3please retrieve the one function from : https://github.com/gnosis/ethcontract-rs
- 4please retrieve the one struct from : https://github.com/gnosis/ethcontract-rs/
- 5where is the zero function in : https://github.com/gnosis/ethcontract-rs/
- 6Please explain this error in my rust code: error[E0015]: cannot call non-const f
- 7I keep getting this error: cannot call non-const fn U256::one in constant functi
- 8I keep getting this error is my ethers-core library for my rust code : cannot ca
- 9cannot call non-const fn U256::iszero in constant functions --> /Users/robertmcc
- User
Why do I always get this error in my rust flashloan code? --> /Users/robertmccormick/.cargo/registry/src/github.com-1ecc6299db9ec823/ethers-core-2.0.0/src/types/i256.rs:128:14 | 128 | Self(U256::one()) | ^^^^^^^^^^^ | = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
- Assistant
The error message is indicating that you are trying to call a non-constant function in a constant function. In this case, you are trying to create a new
U256instance usingU256::one(), which is not a constant function.To resolve this error, you should check if the function that is calling
U256::one()is marked as a constant function or not. If it is not, you should consider marking it as a constant function. If that is not possible, you should consider changing the way you are creating theU256instance to use a constant function or a tuple struct/variant.