aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-04-16 10:08:25 +0800
committerobscuren <geffobscura@gmail.com>2014-04-16 10:08:25 +0800
commit1cd7d4456b80c38f343cb54a624408c28c5acb13 (patch)
treede63c196b7a707a9bbc0787fb7af9992bf628948 /ethereal
parent6b644c17a7ff2746863c03f2d67b24ae75951256 (diff)
downloadgo-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar.gz
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar.bz2
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar.lz
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar.xz
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.tar.zst
go-tangerine-1cd7d4456b80c38f343cb54a624408c28c5acb13.zip
Updated to use new state object
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/ui/gui.go2
-rw-r--r--ethereal/ui/library.go25
-rw-r--r--ethereal/ui/ui_lib.go18
3 files changed, 12 insertions, 33 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index 1065b716e..fd29c4820 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -170,7 +170,7 @@ func (ui *Gui) update() {
txChan := make(chan ethchain.TxMsg, 1)
ui.eth.TxPool().Subscribe(txChan)
- account := ui.eth.StateManager().GetAddrState(ui.addr).Account
+ account := ui.eth.StateManager().GetAddrState(ui.addr).Object
unconfirmedFunds := new(big.Int)
ui.win.Root().Call("setWalletValue", fmt.Sprintf("%v", ethutil.CurrencyToString(account.Amount)))
for {
diff --git a/ethereal/ui/library.go b/ethereal/ui/library.go
index 76032f400..6c6f7557a 100644
--- a/ethereal/ui/library.go
+++ b/ethereal/ui/library.go
@@ -6,7 +6,6 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
- "github.com/obscuren/mutan"
"github.com/obscuren/secp256k1-go"
"strings"
)
@@ -44,22 +43,6 @@ func (lib *EthLib) CreateAndSetPrivKey() (string, string, string, string) {
return mnemonicString, fmt.Sprintf("%x", pair.Address()), fmt.Sprintf("%x", prv), fmt.Sprintf("%x", pub)
}
-// General compiler and preprocessor function
-func compile(script string) ([]byte, error) {
- asm, errors := mutan.Compile(strings.NewReader(script), false)
- if len(errors) > 0 {
- var errs string
- for _, er := range errors {
- if er != nil {
- errs += er.Error()
- }
- }
- return nil, fmt.Errorf("%v", errs)
- }
-
- return ethutil.Assemble(asm...), nil
-}
-
func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data string) (string, error) {
var hash []byte
var contractCreation bool
@@ -81,18 +64,16 @@ func (lib *EthLib) CreateTx(recipient, valueStr, gasStr, gasPriceStr, data strin
// Compile and assemble the given data
if contractCreation {
mainInput, initInput := ethutil.PreProcess(data)
- mainScript, err := compile(mainInput)
+ mainScript, err := utils.Compile(mainInput)
if err != nil {
return "", err
}
- initScript, err := compile(initInput)
+ initScript, err := utils.Compile(initInput)
if err != nil {
return "", err
}
- // TODO
- fmt.Println(initScript)
- tx = ethchain.NewContractCreationTx(value, gasPrice, mainScript)
+ tx = ethchain.NewContractCreationTx(value, gasPrice, mainScript, initScript)
} else {
tx = ethchain.NewTransactionMessage(hash, value, gasPrice, gas, nil)
}
diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go
index b2552cdce..a0d2f557a 100644
--- a/ethereal/ui/ui_lib.go
+++ b/ethereal/ui/ui_lib.go
@@ -6,14 +6,13 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
+ "github.com/ethereum/go-ethereum/utils"
"github.com/niemeyer/qml"
- "github.com/obscuren/mutan"
"math/big"
"os"
"path"
"path/filepath"
"runtime"
- "strings"
)
type memAddr struct {
@@ -99,25 +98,24 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
state := ui.eth.BlockChain().CurrentBlock.State()
mainInput, _ := ethutil.PreProcess(data)
- asm, err := mutan.Compile(strings.NewReader(mainInput), false)
+ callerScript, err := utils.Compile(mainInput)
if err != nil {
- fmt.Println(err)
- for _, e := range err {
- ui.win.Root().Call("addDebugMessage", e.Error())
- }
+ ethutil.Config.Log.Debugln(err)
+
+ return
}
- callerScript := ethutil.Assemble(asm...)
dis := ethchain.Disassemble(callerScript)
ui.win.Root().Call("clearAsm")
+
for _, str := range dis {
ui.win.Root().Call("setAsm", str)
}
- callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasPriceStr), callerScript)
+ callerTx := ethchain.NewContractCreationTx(ethutil.Big(valueStr), ethutil.Big(gasPriceStr), callerScript, nil)
// Contract addr as test address
keyPair := ethutil.Config.Db.GetKeys()[0]
- account := ui.eth.StateManager().GetAddrState(keyPair.Address()).Account
+ account := ui.eth.StateManager().GetAddrState(keyPair.Address()).Object
c := ethchain.MakeContract(callerTx, state)
callerClosure := ethchain.NewClosure(account, c, c.Script(), state, ethutil.Big(gasStr), new(big.Int))