massalabs / docs

Massa Protocol Documentation
https://docs.massa.net/
14 stars 65 forks source link

Document Coins usage in smart contract #198

Open Ben-Rey opened 1 year ago

Ben-Rey commented 1 year ago

There seems to be confusion regarding the use of coins in smart contracts, whether it's for a function call or during deployment.

Some example of questions:

@damip Please challenge the questions if they appear unclear or illogical.

damip commented 1 year ago

Here are succinct responses that should be added to the docs.

Transferring coins

Storage charges

When calling create_sc, two charges happen:

Space is always available because occupying space requires locking coins. The available space is therefore naturally limited by the total supply of coins in circulation, but as long as you have coins you can always store.

Storage is paid by the address at the top of the call stack. When storage bytes are freed, the unlocked coins are given to the address on top of the call stack.

Ben-Rey commented 1 year ago

Very clear thanks !

qdrn commented 1 year ago

It's a good opportunity to explain in which context accounts have write access.

qdrn commented 1 year ago

Not directly related but in the previous documentation there was this document that was created which documented the stack https://github.com/massalabs/massa-docs/blob/main/web3-dev/smart-contracts/address-stack.rst.