update compiler spec
This commit is contained in:
parent
1b858514e8
commit
a74e0aaa8c
|
@ -43,9 +43,12 @@ Compiler.prototype.compile_solidity = function(contractFiles) {
|
|||
return compiled_object;
|
||||
};
|
||||
|
||||
Compiler.prototype.compile_serpent = function(contractFile) {
|
||||
Compiler.prototype.compile_serpent = function(contractFiles) {
|
||||
var cmd, result, output, json, compiled_object;
|
||||
|
||||
//TODO: figure out how to compile multiple files and get the correct json
|
||||
var contractFile = contractFiles[0];
|
||||
|
||||
cmd = "serpent compile " + contractFile;
|
||||
|
||||
result = exec(cmd, {silent: true});
|
||||
|
@ -82,10 +85,9 @@ Compiler.prototype.compile_serpent = function(contractFile) {
|
|||
return compiled_object;
|
||||
}
|
||||
|
||||
|
||||
Compiler.prototype.compile = function(contractFiles) {
|
||||
var solidity = [], serpent = [];
|
||||
|
||||
|
||||
for (var i = 0; i < contractFiles.length; i++) {
|
||||
var extension = contractFiles[i].split('.')[1];
|
||||
if (extension === 'sol') {
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('embark.compiler', function() {
|
|||
it("should build a correct compiled object", function() {
|
||||
var compiler = new Compiler();
|
||||
|
||||
var compiledFile = compiler.compile(files[0]);
|
||||
var compiledFile = compiler.compile(files);
|
||||
|
||||
assert.equal(compiledFile.SimpleStorage.code, '60606040526040516020806075833950608060405251600081905550604e8060276000396000f3606060405260e060020a60003504632a1afcd98114602e57806360fe47b11460365780636d4ce63c146040575b005b604460005481565b600435600055602c565b6000545b6060908152602090f3');
|
||||
|
||||
|
@ -28,7 +28,7 @@ describe('embark.compiler', function() {
|
|||
it("throw an error", function() {
|
||||
var compiler = new Compiler();
|
||||
|
||||
assert.throws(function() { compiler.compile(files[0]) }, Error);
|
||||
assert.throws(function() { compiler.compile(files) }, Error);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -41,7 +41,7 @@ describe('embark.compiler', function() {
|
|||
it("should build a correct compiled object", function() {
|
||||
var compiler = new Compiler();
|
||||
|
||||
var compiledFile = compiler.compile(files[0]);
|
||||
var compiledFile = compiler.compile(files);
|
||||
|
||||
assert.equal(compiledFile.cash.code, '6000603f536a0186a000000000000000006040604059905901600090526000815232816020015280905020556103658061003a60003961039f56600061047f537c010000000000000000000000000000000000000000000000000000000060003504638357984f81141561005f57600435604052604060405990590160009052600081526040518160200152809050205460605260206060f35b63693200ce8114156101465760043560a05260243560c0523260e0526040604059905901600090526000815260e051816020015280905020546101005260c051610100511215156101385760c0516040604059905901600090526000815260e05181602001528090502054036040604059905901600090526000815260e0518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516101c05260206101c0f3610145565b60006101e05260206101e0f35b5b6380b97fc081141561024c5760043560a05260243560c05260443561020052326102005114151561017e576000610220526020610220f35b6040604059905901600090526000815261020051816020015280905020546101005260c0516101005112151561023e5760c0516040604059905901600090526000815261020051816020015280905020540360406040599059016000905260008152610200518160200152809050205560c0516040604059905901600090526000815260a05181602001528090502054016040604059905901600090526000815260a0518160200152809050205560c0516102e05260206102e0f361024b565b6000610300526020610300f35b5b634c764abc8114156102b4576004356103205260243561034052610340516040604059905901600090526000815261032051816020015280905020540360406040599059016000905260008152610320518160200152809050205560016103a05260206103a0f35b63a92c9b8381141561031c57600435610320526024356103405261034051604060405990590160009052600081526103205181602001528090502054016040604059905901600090526000815261032051816020015280905020556001610400526020610400f35b631d62e92281141561036357600435604052602435610420526104205160406040599059016000905260008152604051816020015280905020556001610460526020610460f35b505b6000f3');
|
||||
|
||||
|
@ -59,7 +59,7 @@ describe('embark.compiler', function() {
|
|||
it("throw an error", function() {
|
||||
var compiler = new Compiler();
|
||||
|
||||
assert.throws(function() { compiler.compile(files[0]) }, Error);
|
||||
assert.throws(function() { compiler.compile(files) }, Error);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
# This software (Augur) allows buying && selling event outcomes in ethereum
|
||||
# Copyright (C) 2015 Forecast Foundation
|
||||
# This program is free software; you can redistribute it &&/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is free software: you can redistribute it &&/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# Any questions please contact joey@augur.net
|
||||
|
||||
data cashcoinBalances[]
|
||||
|
||||
def init():
|
||||
# test initial funds
|
||||
self.cashcoinBalances[tx.origin] = 100000*2^64
|
||||
|
||||
# @return: cash balance of address
|
||||
def balance(address):
|
||||
return(self.cashcoinBalances[address])
|
||||
|
||||
# should send values as fixed point in UI (1 is 2^64, 4 is 4*2^64, .5 is 2^63, etc.)
|
||||
# so cashcoin fees could just go to root branch, or we could not have fees besides
|
||||
# gas fee to do a send transaction
|
||||
# @return: value sent, 0 if fails
|
||||
def send(recver, value):
|
||||
sender = tx.origin
|
||||
senderBalance = self.cashcoinBalances[sender]
|
||||
if(senderBalance >= value):
|
||||
self.cashcoinBalances[sender] -= value
|
||||
self.cashcoinBalances[recver] += value
|
||||
return(value)
|
||||
else:
|
||||
return(0)
|
||||
|
||||
# @return value of cash sent; fail is 0
|
||||
def sendFrom(recver, value, from):
|
||||
if(from!=tx.origin):
|
||||
return(0)
|
||||
senderBalance = self.cashcoinBalances[from]
|
||||
if(senderBalance >= value):
|
||||
self.cashcoinBalances[from] -= value
|
||||
self.cashcoinBalances[recver] += value
|
||||
return(value)
|
||||
else:
|
||||
return(0)
|
||||
|
||||
# make sure only coming from specific contracts
|
||||
def subtractCash(ID, amount):
|
||||
#if(!self.whitelist.check(msg.sender)):
|
||||
# return(-1)
|
||||
self.cashcoinBalances[ID] -= amount
|
||||
return(1)
|
||||
|
||||
def addCash(ID, amount):
|
||||
#if(!self.whitelist.check(msg.sender)):
|
||||
# return(-1)
|
||||
self.cashcoinBalances[ID] += amount
|
||||
return(1)
|
||||
|
||||
def setCash(address, balance):
|
||||
#if !self.whitelist.check(msg.sender):
|
||||
# return(-1)
|
||||
self.cashcoinBalances[address] = balance
|
||||
return(1)
|
Loading…
Reference in New Issue