1

This is an example of the WAVES IDE. Please tell me how to use InvokeScriptTransaction to execute ‘func divideAmount ()’.

# waves IDE example
let Alice = Address(base58'3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8')
let Bob = Address(base58'3N78bNBYhT6pt6nugc6ay1uW1nLEfnRWkJd')

@Callable(i)
func divideAmount() = {

    let transferAmount = wavesBalance(this) / 2

    TransferSet([
                ScriptTransfer(Alice, transferAmount, unit),
                ScriptTransfer(Bob, transferAmount, unit)
    ])
}

I set a script for my account on the test net. However, I do not understand that it calls with InvokeScriptTransaction.

rah
  • 69
  • 3

1 Answers1

1

If you use IDE you can run in the console. It is also available in the JS library (waves-transactions).

broadcast(invokeScript({contractAddress: {CONTRACT_ADDRESS_HERE}), call:{function:"divideAmount",args:[]}, payment: []}))
Nazim Faour
  • 804
  • 4
  • 6