Run smart contract function
Line 9: | Line 9: | ||
'''Function Name:''' The name of the function you want to run on the smart contract. | '''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 | + | '''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 == | ||
− | This function returns the result of the function executed | + | This function returns the result of the function executed, either as plain text, or as a yaml object. |
== Example == | == Example == | ||
Line 19: | Line 28: | ||
<pre> | <pre> | ||
config defi wallet("your private key") | config defi wallet("your private key") | ||
− | log( | + | log object($run smart contract function("BinanceSmartChain", "0x1234abcd5678efgh9012ijkl34mn56op7890qrstu", "balanceOf", '"0xabcdef123456ghijklm789012nopqr3456stuvwx89"')) |
</pre> | </pre> | ||
Line 26: | Line 35: | ||
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. | 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 | + | The above example gets the "balanceOf" function result for the specified wallet address on a specific smart contract in the Binance Smart Chain. |
− | + | ||
− | + |
Revision as of 20:13, 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.
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
Return Value
This function returns the result of the function executed, either as plain text, or as a yaml object.
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.
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.