ethereum / serpent

Other
366 stars 107 forks source link

serpent not generating correct ABI for a method with a return #86

Open iurimatias opened 9 years ago

iurimatias commented 9 years ago
def init():
    self.storage[msg.sender] = 1000000

def balance_query(k):
    return(self.storage[addr])

def send(to, value):
    fromvalue = self.storage[msg.sender]
    if fromvalue >= value:
        self.storage[from] = fromvalue - value
        self.storage[to] += value

serpent mk_full_signature sub.se

generates:

[{
    "name": "balance_query(int256)",
    "type": "function",
    "inputs": [{ "name": "k", "type": "int256" }],
    "outputs": [{ "name": "out", "type": "int256" }]
},
{
    "name": "send(int256,int256)",
    "type": "function",
    "inputs": [{ "name": "to", "type": "int256" }, { "name": "value", "type": "int256" }],
    "outputs": []
}]

However, the first method should have constant: true otherwise web3 thinks this is transaction and doesn't return the correct value.