Call

Solidity

परिभाषा

Call एक low-level function है जो दूसरे contracts को invoke करने के लिए use होता है। यह ABI encoding/decoding handle नहीं करता और remaining gas को forward करता है। Call से arbitrary data भेजा जा सकता है और return value को manually decode करना पड़ता है। Modern Solidity में, सुरक्षा के लिए इसे सावधानी से use करना चाहिए।

English version

Call is a low-level function used to invoke other contracts. It does not handle ABI encoding/decoding and forwards all remaining gas. Call can send arbitrary data and return values must be manually decoded. In modern Solidity, it should be used carefully for security reasons.

Code Example

// Appel bas niveau avec call
(bool success, bytes memory data) = address(target).call(
    abi.encodeWithSignature("transfer(address,uint256)", recipient, amount)
);
require(success, "Call failed");

// Envoyer de l'ETH avec call
(bool sent, ) = recipient.call{value: 1 ether}("");
require(sent, "ETH transfer failed");

संबंधित शब्द

Solingo पर इस concept को practice करें

Call को interactive exercises और integrated IDE के साथ master करें।

मुफ्त में शुरू करें