Fallback
Solidityपरिभाषा
Fallback एक special function है जो तब execute होता है जब contract को एक call मिलता है जो किसी existing function से match नहीं करता, या जब ether receive करता है बिना data के। Solidity 0.6.0+ में, fallback() और receive() separate हैं।
English version
Fallback is a special function that executes when a contract receives a call that doesn't match any existing function, or when it receives ether without data. In Solidity 0.6.0+, fallback() and receive() are separate.
Code Example
contract MyContract {
// Recevoir de l'ETH sans données
receive() external payable {
emit Received(msg.sender, msg.value);
}
// Appels vers fonctions inexistantes
fallback() external payable {
emit FallbackCalled(msg.sender, msg.data);
}
}संबंधित पेज
Solingo पर इस concept को practice करें
Fallback को interactive exercises और integrated IDE के साथ master करें।
मुफ्त में शुरू करें