Get contract functions

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
'''$list contract functions''' is a function that returns a list of functions available on a specified smart contract. This is specifically designed for enterprise users managing a series of interactions on the blockchain.
+
'''$contract functions''' is a function that returns a list of functions on a specific smart contract.
 +
 
 +
This command retrieves all function signatures from the smart contract of a specific chain.
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The specific blockchain network where the smart contract is located. The options in the dropdown include Avalanche and Binance Smart Chain.
+
'''Chain:''' The specific blockchain chain where the smart contract resides. It can be either "Avalanche" or "BinanceSmartChain".
  
'''Contract Address:''' The address of the particular smart contract for which the list of functions will be retrieved.
+
'''Contract Address:''' The address of the smart contract from which function details are to be fetched.
  
 
== Return Value ==
 
== Return Value ==
 
+
This function returns a list of function names available in the smart contract as a string.
This function returns a string that represents a list of functions available on the specified smart contract.
+
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
ui console view
+
log("Functions in Smart Contract: {$contract functions("BinanceSmartChain","0x000...")}")
config defi wallet("your private key here")
+
log("List of Contract Functions: {$list contract functions("BinanceSmartChain","0xBCfCcbde45cE874adCB698cC183deBcF17952812")}")
+
 
</pre>
 
</pre>
  
Please replace "your private key here" with your actual private key. Because private keys are extremely sensitive, exercise caution in handling them.
+
The output will be a list of strings where each string represents a function present in the smart contract.
  
The output of this script will display a list of functions available on the specified smart contract (at address "0xBCfCcbde45cE874adCB698cC183deBcF17952812" on the "BinanceSmartChain"). An example of the output could look something like:
+
Please remember to replace "0x000..." with the actual address of the smart contract you are interacting with.
  
 +
Example Output:
 
<blockquote>
 
<blockquote>
List of Contract Functions: getReserves,swapExactTokensForTokensSupportingFeeOnTransferTokens,swapExactETHForTokensSupportingFeeOnTransferTokens,swapExactTokensForETHSupportingFeeOnTransferTokens
+
<p>Functions in Smart Contract: ["balanceOf", "transfer", "approve", "allowance", "transferFrom", "safeTransferFrom", "mint", "burn"]</p>
 
</blockquote>
 
</blockquote>

Revision as of 19:06, 4 July 2023

$contract functions is a function that returns a list of functions on a specific smart contract.

This command retrieves all function signatures from the smart contract of a specific chain.

Parameters

Chain: The specific blockchain chain where the smart contract resides. It can be either "Avalanche" or "BinanceSmartChain".

Contract Address: The address of the smart contract from which function details are to be fetched.

Return Value

This function returns a list of function names available in the smart contract as a string.

Example

log("Functions in Smart Contract: {$contract functions("BinanceSmartChain","0x000...")}")

The output will be a list of strings where each string represents a function present in the smart contract.

Please remember to replace "0x000..." with the actual address of the smart contract you are interacting with.

Example Output:

Functions in Smart Contract: ["balanceOf", "transfer", "approve", "allowance", "transferFrom", "safeTransferFrom", "mint", "burn"]

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox