-
Describe your question in detail. For example how do you get all transactions for a user with the TypeScript SDK?So, I'm trying to create a module where I can deposit APT coin. But, on this line of code: coin::deposit(&mut holder.balance, coin);, I'm encountering this error: 'Incompatible type '&mut Coin', expected 'address'.' I understand that it requires an address, but when I tried to use '@box', it worked. But, when I attempt to make a deposit, it deposits into my wallet, which I used to deploy this module. What error, if any, are you getting?No response What have you tried or looked at? Or how can we reproduce the error?
Which operating system are you using?Windows Which SDK or tool are you using? (if any)Aptos CLI Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
First of all, type signature of coin::deposit is Types of what you provided are: It worked when you provided @box as In Aptos Move, when you deploy a smart contract (Move module), it is published under an Account. "Module" itself doesn't hold APT balance. Account holds "Modules" and "Resources", and APT is one of the "Resources". So, basically your Move module is under the account you used when deploying the module. There's no "Smart Contract Account" created to store the module here. |
Beta Was this translation helpful? Give feedback.
-
thank you for information |
Beta Was this translation helpful? Give feedback.
First of all, type signature of coin::deposit is
public fun deposit<CoinType>(account_addr: address, coin: Coin<CoinType>) acquires CoinStore
Types of what you provided are:
&mut holder.balance:
&mut Coin<CoinType>
, coin:Coin<CoinType>
You should provide
address
type foraccount_addr
param.It worked when you provided @box as
account_addr
arg because @box is an alias for the deployer address in this case.In Aptos Move, when you deploy a smart contract (Move module), it is published under an Account. "Module" itself doesn't hold APT balance. Account holds "Modules" and "Resources", and APT is one of the "Resources". So, basically your Move module is under the account you used when deploy…