2

I'm asking myself if the call to a function like transfer in solidity is asynchronous.

In other words, I'm working with the following contract

function count_and_pay() public {
    if (lockCon == true)
         return;
    if (positiveVote > negativeVote) {
        candidate.transfer(proprietyContract);
    } else {
        escrow.transfer(proprietyContract);
    }
    lockCon = true
}

I'm a little worried here because I'm not able to find any resource where it saying the call escrow.transfer(proprietyContract); make the transaction and will continue in the execution of the call.

In my knowledge the method is asynchronous and it will create only the transaction of the blockchain and will continue the execution. With this scenario, my code should be technically correct (but without meaning).

2

<address>.transfer in Solidity is synchronous.

That means it completes, before the next line lockCon = true runs.

Note: the argument to transfer is an amount in wei, not a contract.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.