2017-04-09 44 views
1

我有Enthereum的anready部署合同。 我想從它調用函數。如何調用合同函數從已部署合同復仇

現在我能做到這一點:

watch_addr.call(bytes4(sha3("register()"))) 

但是,只有當函數沒有參數。 使用參數我嘗試這一點,但沒有成功:

watch_addr.call(bytes4(sha3("register("This text is hard codded")"))) 

我讀這個解決方案:https://ethereum.stackexchange.com/questions/2826/call-function-on-another-contract 但我不能這樣做,因爲第一份合同已經部署,當我部署第二個合同,我不t知道第一個源代碼。 因此,該解決方案是不適合我。

我需要一個像這樣的命令:

watch_addr.call(bytes4(sha3("register("This text is hard codded")"))) 

如何我可以調用函數與其他合同參數? 任何想法...

回答

1
watch_addr.call(bytes4(sha3("Bar(int256)")), 42);