Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending value to a contract doesn't seem to work #113

Open
agroce opened this issue Mar 21, 2018 · 1 comment
Open

Sending value to a contract doesn't seem to work #113

agroce opened this issue Mar 21, 2018 · 1 comment

Comments

@agroce
Copy link

agroce commented Mar 21, 2018

This code gives a TransactionFailed. If I change value to 0, it works, but then I can't actually have contracts use send/transfer. It also doesn't work to do a send transaction with the to being the contractAddress.

from testrpc.client import EthTesterClient
from solc import *
from solc.exceptions import SolcError

c = EthTesterClient()

ac = sorted(c.get_accounts())

contract = """
contract c {

function f() returns (int) {
  return 10;
}

}
"""

bin = compile_source(contract,optimize=True).values()[0]['bin']

txnHash = c.send_transaction(_from = ac[0], data = bytes(bin), value=1000)

txnReceipt = c.get_transaction_receipt(txnHash)
contractAddress = txnReceipt['contractAddress']

print (contractAddress), c.get_balance(contractAddress)
@agroce
Copy link
Author

agroce commented Mar 21, 2018

(not using solc-py and just including the contract bin, even the one from tests/client/test_call.py, doesn't help)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant