Simply put, struct is similar to an array, but supports different data types. In an integer array, only integers are allowed. Similarly in an address array, only addresses are allowed. But if you want to store different data types under a single handle, struct is used

Dec 15, 2020, 12:17 PM
For example, in an structure named student, you can have
Name which is a string
Roll no which is int
Class which is also int
Kinda like object, but does not hold properties of oop
Are contracts directly able to detect token transfer of an erc777 token?
Coming to the contract itself
I am just looking for a way to "deposit" token to my contract
Any clues...?
Dec 15, 2020, 4:23 PM
transferFrom()
nvm, for ERC777 it's operatorSend()
Dec 15, 2020, 4:40 PM
But that needs approve() yo be called beforehand right? Isn't there a more convenient method for erc777 while calling transfer() to a contract address...
Dec 15, 2020, 5:42 PM
I doubt it
Dec 15, 2020, 5:43 PM
So what exactly is the improvement on erc777 from 20?
Dec 15, 2020, 5:43 PM
ERC-721 isn't an improvement of ERC20
Dec 15, 2020, 5:47 PM
...
Then why is it created?
.
Without using the normal approve + transferFrom
Dec 15, 2020, 5:55 PM
Yes you can create you “own” specific transfer functions
But for exchanges worldwide
And dapps
Hey interact with your token due to “transfer” and “approve” key words
That’s why exchanges ask if your token is an Erc 20 or something
They*
Dec 15, 2020, 5:57 PM
This is what I actually want to implement
The usual way is to make an approve() call from user and then another function call which will initiate transferFrom from the contract
That's 2 calls
I was looking for a workaround with just one call...
Like an erc which sends some "special signal" to the contract that can be used to identify the incoming token transaction
Not even sure that exists....
Dec 15, 2020, 6:01 PM
Hum Robot bro wished I knew to help you
But I’m pretty sure it most exist the Erc you’re searching for
Must*
Dec 15, 2020, 6:03 PM
Token transaction just updates few variable
Dec 15, 2020, 6:05 PM
I know...
But isn't there some erc which identifies the receiver as contract and does some extra steps?
Dec 15, 2020, 6:06 PM
It does ERC777
But won't be effective for ERC20
Dec 15, 2020, 6:07 PM
No worries coz the token I am concerned about is an erc777
Is there any tuts where I can refer how its done?
Dec 15, 2020, 6:08 PM
Openzeppelin
Dec 15, 2020, 6:09 PM
Alright
Thanks
Dec 15, 2020, 6:10 PM

© 2024 Draquery.com All rights reserved.