"Dividing funds into two parts equally" example of ride4 does not work


#1

“Dividing funds into two parts equally” example of ride4 does not work


#2

Hello, we fixed the mistakes in that example. please find here the correct one. The first 3 lines are important to include ride4dapps standard functionality. Also the function ContractTransfer requires the first parameter to be an address as byte vector therefor you need to include type Address when you define Alice & Bob addresses.

{-# STDLIB_VERSION 3 #-}
{-# CONTENT_TYPE CONTRACT #-}
{-# SCRIPT_TYPE ACCOUNT #-}

# predefined addresses of recipients
let Alice = Address(base58'3NBVqYXrapgJP9atQccdBPAgJPwHDKkh6A8')
let Bob = Address(base58'3N78bNBYhT6pt6nugc6ay1uW1nLEfnRWkJd')

@Callable(i)
func divideAmount() = {
# calculate the amount of WAVES that will be transferred to Alice and Bob
    let transferAmount = wavesBalance(this) / 2
# the result of a contract invocation contains two transfers (to Alice and to Bob)
    TransferSet([
                ContractTransfer(Alice, transferAmount, unit),
                ContractTransfer(Bob, transferAmount, unit)
    ])
}