I have a handful of questions below, with some example data at the top to help make my questions a bit more clear.
Solidity code:
contract TestObject {
address sender;
uint data;
function TestObject() {
sender = msg.sender;
}
function set(uint x) {
if (msg.sender != sender) return;
data = x;
}
function get() constant returns (uint retVal) {
return data;
}
}
Hex:
60056011565b609080601f6000396000f35b336000819060000155505b5600600160008035811a818181146018578301818114602857005b601e6082565b8060005260206000f35b60316001356037565b60006000f35b60005473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156070576074565b607f565b806001819060000155505b50565b60006001549050608d565b9056
Results of publishing transaction:
tx hash: af5c9276edf4abfab86fa8d4df7dde0f84f17679551b8bb1cf9b8288f87d7e57
address: mqGf3q3TmSo1HbLium8tgqbxpdFpkXybyN
contract id: d6c394dd8212c1e7e54628114e055068aba69422
Questions:
- How is the contract id created?
- How do I call the TestObject constructor (function TestObject() )?
- After instantiating TestObject how do I call it’s methods (The functions set and get)?
- Counterparty-cli.py execute seems like it should be able to call a particular method from my contract, but I can't figure out how to specify the method name which makes me think that it doesn't do what I hoped it would. How do I use execute?
contract TestContract {
address testObjectAddress;
TestObject testObject;
function TestContract() {
testObjectAddress = 0xd6c394dd8212c1e7e54628114e055068aba69422;
TestObject testObject = TestObject(testObjectAddress);
}
function getFromTestObject() {
uint data = testObject.get();
}
}
contract TestObject {
function TestObject() {}
function set(uint x) {}
function get() constant returns (uint retVal) {}
}
Questions:
- What should testObjectAddress be (is it mqGf3q3TmSo1HbLium8tgqbxpdFpkXybyN, or d6c394dd8212c1e7e54628114e055068aba69422, or neither?)