Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
YaronWittenstein committed Sep 24, 2021
1 parent 4aaf5e1 commit 7132974
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions svm/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,11 @@ func (rt *Runtime) IncreaseBalance(addr Account, amount Amount) {
panic("TODO")
}

func NewEvelope(principal Address, amount Amount, nonce TxNonce, gasLimit Gas, gasFee GasFee) Envelope {
func NewEvelope(principal Address, amount Amount, txNonce TxNonce, gasLimit Gas, gasFee GasFee) Envelope {
env := Envelope{}
env.Principal = principal
env.Amount = amount
env.Nonce = nonce
env.TxNonce = txNonce
env.GasLimit = gasLimit
env.GasFee = gasFee
return env
Expand Down Expand Up @@ -267,20 +267,20 @@ func EncodeEnvelope(env *Envelope) []byte {

// `Amount`
p := AddressLength
binary.BigEndian.PutUint64(bytes[p:p+AmountLength], env.Amount)
binary.BigEndian.PutUint64(bytes[p:p+AmountLength], (uint64)(env.Amount))

// `Tx Nonce`
p += TxNonceLength
binary.BigEndian.PutUint64(bytes[p:p+TxNonceLength/2], env.TxNonce.Upper)
binary.BigEndian.PutUint64(bytes[p:p+TxNonceLength/2], env.TxNonce.Lower)
binary.BigEndian.PutUint64(bytes[p:p+TxNonceLength/2], (uint64)(env.TxNonce.Upper))
binary.BigEndian.PutUint64(bytes[p:p+TxNonceLength/2], (uint64)(env.TxNonce.Lower))

// `Gas Limit`
p += GasLength
binary.BigEndian.PutUint64(bytes[p:p+GasLength], env.GasLimit)
binary.BigEndian.PutUint64(bytes[p:p+GasLength], (uint64)(env.GasLimit))

// `Gas Fee`
p += GasFeeLength
binary.BigEndian.PutUint64(bytes[p:p+GasFeeLength], env.GasFee)
binary.BigEndian.PutUint64(bytes[p:p+GasFeeLength], (uint64)(env.GasFee))

return bytes
}

0 comments on commit 7132974

Please sign in to comment.