本文整理匯總了Golang中github.com/ethereum/eth-go/ethutil.Value.BigInt方法的典型用法代碼示例。如果您正苦於以下問題:Golang Value.BigInt方法的具體用法?Golang Value.BigInt怎麽用?Golang Value.BigInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ethereum/eth-go/ethutil.Value
的用法示例。
在下文中一共展示了Value.BigInt方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExecuteObject
func (self *Pipe) ExecuteObject(object *Object, data []byte, value, gas, price *ethutil.Value) ([]byte, error) {
var (
initiator = ethstate.NewStateObject([]byte{0})
block = self.blockChain.CurrentBlock
stateObject = object.StateObject
)
if self.Vm.State == nil {
self.Vm.State = self.World().State().Copy()
}
vm := ethvm.New(NewEnv(self.Vm.State, block, value.BigInt(), initiator.Address()))
closure := ethvm.NewClosure(ðstate.Message{}, initiator, stateObject, object.Code, gas.BigInt(), price.BigInt())
ret, _, err := closure.Call(vm, data)
return ret, err
}
示例2: Transact
func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price *ethutil.Value, data []byte) ([]byte, error) {
var hash []byte
var contractCreation bool
if rec == nil {
contractCreation = true
}
var tx *ethchain.Transaction
// Compile and assemble the given data
if contractCreation {
script, err := ethutil.Compile(string(data), false)
if err != nil {
return nil, err
}
tx = ethchain.NewContractCreationTx(value.BigInt(), gas.BigInt(), price.BigInt(), script)
} else {
data := ethutil.StringToByteFunc(string(data), func(s string) (ret []byte) {
slice := strings.Split(s, "\n")
for _, dataItem := range slice {
d := ethutil.FormatData(dataItem)
ret = append(ret, d...)
}
return
})
tx = ethchain.NewTransactionMessage(hash, value.BigInt(), gas.BigInt(), price.BigInt(), data)
}
acc := self.stateManager.TransState().GetOrNewStateObject(key.Address())
tx.Nonce = acc.Nonce
acc.Nonce += 1
self.stateManager.TransState().UpdateStateObject(acc)
tx.Sign(key.PrivateKey)
self.obj.TxPool().QueueTransaction(tx)
if contractCreation {
logger.Infof("Contract addr %x", tx.CreationAddress())
return tx.CreationAddress(), nil
}
return tx.Hash(), nil
}