Hey Everyone,
Beginner questions warning.

I want to create a contract that one wallet owner can only update.
Therefore I'll be happy to know the following:
1. How to store an address on the smart contract? Can I use a global variable for that?
2. what is the data type of a wallet address? Is it a string or a slice?
3. Can the wallet address be fetched from the message data structure?
4. How can I compare two wallet addresses?

Feb 23, 2023, 8:11 PM
1. Global variables don't persist across transactions. You need to store address via putting it in cell and using set_data.
2. Wallet address is slice, usually 267 bit long.
3. your_slice~load_msg_addr()
4. (I'm not sure about whether this function is in the newest stdlib...)
int equal_slices(slice, slice) asm "SDEQ";
...
equal_slices(addr1, addr2)
Feb 24, 2023, 5:16 AM

© 2024 Draquery.com All rights reserved.