1

Can we use transfer function in solidity to transfer the data? My code _dest.transfer(txn.value)(txn.data); and it is showing the error that this type is not callable.

2
  • What do you mean by data? The transfer function from a contract is made to transfer ether from the contract to another address. – Florian Castelain Jun 13 '18 at 13:02
  • 1
    Are you sure we cannot share any comment or data through it....data means any comment or response. – user41280 Jun 13 '18 at 13:19
2

To transfer data from contract A to contract B, you do not use transfer function. transfer is meant to transfer ether.

But if you want to transfer, lets say an integer, from contract A to contract B, your contract B needs to have a function to receive the int. The contract A needs to know contract B's address.

Contract A

function transferInteger(int value) {
contractBAddress.saveInteger(value);
}

Contract B

function saveInteger(int value){
//do whatever you want to do with the integer
}

EDIT: The code above is very basic. You need to do more stuff to get it working, but I showed this just to give you the concept.

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.