1

I uploaded and created a new smart contract. I sent 1000 units to this smart contract.

https://user-images.githubusercontent.com/14315537/129392531-0ec03ae2-fbd8-4497-b5b9-e6d50f89844d.png

However when the contract is deployed the transferable is not equal to 1000.

https://user-images.githubusercontent.com/14315537/129392642-5d42ff72-dc86-488c-893b-7e0ae6e5e36f.png

And when I execute any function it also deducts the transferable.

https://user-images.githubusercontent.com/14315537/129392818-3f462e84-226c-4e79-ba10-9e34aedcfe14.png

Is there any way to prevent this. I want to deduct user token instead of the smart contract token. In Ethereum, the user token is deducted.

karel
  • 5,489
  • 46
  • 45
  • 50
Linh Tran
  • 21
  • 1

1 Answers1

3

I want to deduct user token instead of the smart contract token. In Ethereum, the user token is deducted.

I think there is a misunderstanding here, you probably understood the deducted tokens as gas. But gas is deducted from the instantiating account (what you referred to as "user token"), same as in Ethereum.

The amount that is deducted from the contract here is state rent ‒ i.e. the contract has to regularly pay for the amount of state and code storage it uses. This is a concept which is currently used by the contracts pallet to reduce state bloat. I won't link to the documentation here though, since a new paradigm will be introduced soon, making it obsolete.

cmichi
  • 131
  • 2