1

I am trying to create a contract that only allow people who did send amount of wei to the token , to access a get function by keeping a record of all address & amount . is it possible to do that ? and can i use the events for it ? if yes how the contract can get it's own events history . thanks

0

A contract can't read events: Events are designed for data that doesn't need to be read by a node when it validates a block, which is why they're cheaper than regular storage.

You can store data about users who sent wei to your contract in contract storage, usually by updating a mapping when the contract receives the wei, although this will mean a higher gas cost.

You can restrict access to a get function when it is called as part of a transaction, but be aware that all the information your contract stores is publicly available on the blockchain, so people will still be able to read it even if your function doesn't permit them to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.