Hello,

Sign up to join our community!

Welcome Back,

Please login to your account!

Forgot Password,

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

And167100369 activity

And167100369 commented on I see. But sometimes it is not recommended updating a smart contract as it can mess up everything. In Elrond, is it safe to do it? The common approach is to update the SC? Or the common approach is using a Proxy?

You need to make sure that the new storage layout is compatible with the old layout. It is also good practice to deploy your contract from a multisig so the upgradability is not a security vulnerability. In principle it is the same as having a proxy contract, only more convenient

And167100369 commented on Hi guys! I noticed the following. I am working with 18 decimals so I sometimes need to define numbers like: managed_biguint!(1_000_000_000_000_000_000) This works as expected. However, if I use one more zero: managed_biguint!(10_000_000_000_000_000_000) it yields the incorrect number... even thoug... Read more

Behind the scenes `BigUint`s are actually `BigInt`s with restrictions. This means it will go through an i64 in the process, even if you declare it as u64. Just do `managed_biguint!(1_000_000_000_000_000_000) * 10` or something of the sort

And167100369 commented on Good Evening, rust sc related question. Is there a possibility provide a callback after async call as a simple closure directly? Or Do I need to define a function annotated with #[callback] and use that as following -> self.callbacks().my_callback()?

There's a lot of magic involved there, in the way callbacks currently work. It's made to look like a simple call, but the full process is that a callback proxy gets generated ( self.callbacks().my_callback() is a callback proxy in fact, it is a generated method), which serializes the proxy closure and saves it temporarily to storage. The callback then loads this data from storage and uses it. The syntax is what it is, it is the cleanest I could get. I would have loved to make it look like an actual Rust closure, but the compiler doesn't let me hack so deep.

And167100369 commented on thank you for your answer I understand the advantages and drawbacks of the first method. However for the second, I won't know who are the owner of which nfts. I could scan them all and read their data but that would cost potentially cost a lot of gas right?

You could map users to their NFTs in storage, it's not expensive. It's not necessarily in the spirit of ESDT, more similar to how you would do it on Ethereum, but then you have control over them and can destroy them at will.