Run smart contract function

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
'''$run contract function''' is a function that runs a specific function on a smart contract. This command is especially useful for enterprise users who are actively managing and interacting with various smart contracts.
+
'''$run smart contract function''' is a function in UBot Studio that allows you to execute a function on a specific smart contract on a specified blockchain chain.
  
 
== Parameters ==
 
== Parameters ==
  
'''Chain:''' The blockchain network chain on which the smart contract resides. The chains that can be selected from the dropdown menu include Avalanche and Binance Smart Chain.
+
'''Chain:''' The blockchain on which the smart contract resides.
  
'''Contract Address:''' The address of the smart contract on which the function will be executed.
+
'''Contract Address:''' The address of the smart contract that contains the function you want to execute.  
  
'''Function Name:''' The specific function that is to be executed on the smart contract.
+
'''Function Name:''' The name of the function you want to run on the smart contract.
  
'''Parameters:''' The parameters that are to be passed to the smart contract function. These have to be provided as a single string value, separated by commas.
+
'''Parameters:''' The parameters for the function, if any. They should be written as a list in either yaml or json format. for instance, using json format, parameters might look like:
 +
<pre>
 +
[1,2,3]
 +
</pre>
 +
In yaml format, the same parameters would look like:
 +
<pre>
 +
- 1
 +
- 2
 +
- 3
 +
</pre>
  
 
== Return Value ==
 
== Return Value ==
  
The function returns a string that represents the result of the executed smart contract function.
+
This function returns the result of the function executed, either as plain text, or as a yaml object.
  
 
== Example ==
 
== Example ==
  
 
<pre>
 
<pre>
ui console view
+
config defi wallet("your private key")
config defi wallet("your private key here")
+
log object($run smart contract function("BinanceSmartChain", "0x1234abcd5678efgh9012ijkl34mn56op7890qrstu", "balanceOf", "[0xabcdef123456ghijklm789012nopqr3456stuvwx89]"))
log("Smart Contract Function Result: {$run contract function("BinanceSmartChain","0xBCfCcbde45cE874adCB698cC183deBcF17952812","getReserves","")}")
+
 
</pre>
 
</pre>
  
Do remember to replace "your private key here" with your actual private key. Always handle private keys securely as they are highly sensitive information.
+
Please replace "your private key" with your actual DeFi wallet's private key. Also, change the contract address with the contract address of the token you're checking the balance of. Change the address in the parameters list to be your wallet address.
  
The output of this script will display the result returned by the executed function (in this case "getReserves") on the specified smart contract (at address "0xBCfCcbde45cE874adCB698cC183deBcF17952812" on the "BinanceSmartChain"). The output might look something like:
+
Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.
  
<blockquote>
+
The above example gets the "balanceOf" function result for the specified wallet address on a specific smart contract in the Binance Smart Chain.
Smart Contract Function Result: 0x4a81748738792a0a8c21c0ff6f5f7c8cb6e79e30
+
</blockquote>
+

Latest revision as of 20:15, 4 July 2023

$run smart contract function is a function in UBot Studio that allows you to execute a function on a specific smart contract on a specified blockchain chain.

[edit] Parameters

Chain: The blockchain on which the smart contract resides.

Contract Address: The address of the smart contract that contains the function you want to execute.

Function Name: The name of the function you want to run on the smart contract.

Parameters: The parameters for the function, if any. They should be written as a list in either yaml or json format. for instance, using json format, parameters might look like:

[1,2,3]

In yaml format, the same parameters would look like:

- 1
- 2
- 3

[edit] Return Value

This function returns the result of the function executed, either as plain text, or as a yaml object.

[edit] Example

config defi wallet("your private key")
log object($run smart contract function("BinanceSmartChain", "0x1234abcd5678efgh9012ijkl34mn56op7890qrstu", "balanceOf", "[0xabcdef123456ghijklm789012nopqr3456stuvwx89]"))

Please replace "your private key" with your actual DeFi wallet's private key. Also, change the contract address with the contract address of the token you're checking the balance of. Change the address in the parameters list to be your wallet address.

Be mindful when you are handling your private key. It's a sensitive piece of data that allows full control over your funds in your DeFi wallet. Therefore, never share this key publicly or with anyone.

The above example gets the "balanceOf" function result for the specified wallet address on a specific smart contract in the Binance Smart Chain.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox