Post

CodeMultiversX
CodeMultiversX@CodeMultiversX·
Meet the Tech: Payable Endpoints 🧩 The compile-time mechanism for accepting EGLD or ESDT payments at a contract endpoint. The annotation declares the intent. self.call_value() reads what came in. 💡 🧵
CodeMultiversX tweet media
English
1
24
97
5.4K
CodeMultiversX
CodeMultiversX@CodeMultiversX·
How it works: #[payable] #[endpoint] fn deposit(&self) { let payment = self.call_value().single(); } Without #[payable], any incoming payment causes the endpoint to fail before it runs. Mark the endpoint with #[payable] to accept payments. Read what was sent with self.call_value(). .single() returns exactly one payment — EGLD or ESDT. Panics if zero or more than one came in.
English
1
1
18
214
Paylaş