You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 14, 2023. It is now read-only.
We need to ask the Host for the amount value supplied in the Transaction.
One classic usage is tracking how much money the current executing Account has been funded.
So each time an Account gets funding, it will execute some piece of code (see SVM SDK fundable hooks feature - similar to the payable of Solidity)
That code will ask the Host for the current transaction value to update some Storage variable of itself.
Implementation Proposal
The host function signature should look probably like this:
fntx_amount(env:&FuncEnv) -> u64{// ...}
The amount will be taken from the Envelope.
Fundable Hooks
Fundable hooks are SVM SDK mechanisms to share common pieces of code between different #[endpoint].
When an endpoint wants to use an existing fundable hook, it should add this annotation: #[fundable(FUNDABLE_HOOK_NAME)]
Depends on #487
We need to ask the Host for the
amountvalue supplied in the Transaction.One classic usage is tracking how much money the current executing Account has been funded.
So each time an
Accountgets funding, it will execute some piece of code (see SVM SDKfundable hooksfeature - similar to thepayableof Solidity)That code will ask the Host for the current transaction
valueto update some Storage variable of itself.Implementation Proposal
The host function signature should look probably like this:
The
amountwill be taken from theEnvelope.Fundable Hooks
Fundable hooks are SVM SDK mechanisms to share common pieces of code between different
#[endpoint].When an
endpointwants to use an existingfundable hook, it should add this annotation:#[fundable(FUNDABLE_HOOK_NAME)]Links:
Open Question
Accountask for its current balance? (in a running Contract code).svm_tx_amountcan be called from withinverify? (I don't see any problem with that since it's part of the Transaction)