| 251 | } |
| 252 | |
| 253 | func addIssueMeta(issuance *Issuance, txIss bc.Issuance, tx *bc.Tx, logPos int) { |
| 254 | if logPos < 2 || logPos+1 >= len(tx.Log) { |
| 255 | return |
| 256 | } |
| 257 | |
| 258 | nonceTuple := tx.Log[logPos-2] |
| 259 | if len(nonceTuple) != 5 { |
| 260 | return |
| 261 | } |
| 262 | if nonceTuple[0].(txvm.Bytes)[0] != txvm.NonceCode { |
| 263 | return |
| 264 | } |
| 265 | |
| 266 | timerangeTuple := tx.Log[logPos-1] |
| 267 | if len(timerangeTuple) != 4 { |
| 268 | return |
| 269 | } |
| 270 | if timerangeTuple[0].(txvm.Bytes)[0] != txvm.TimerangeCode { |
| 271 | return |
| 272 | } |
| 273 | |
| 274 | v1Seed := standard.AssetContractSeed[1] |
| 275 | v2Seed := standard.AssetContractSeed[2] |
| 276 | refdataTuple, ok := logTuple(tx.Log[logPos+1], &v2Seed) |
| 277 | if !ok { |
| 278 | refdataTuple, ok = logTuple(tx.Log[logPos+1], &v1Seed) |
| 279 | if !ok { |
| 280 | return |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | issuance.Quorum = int(txIss.Stack[0].(txvm.Tuple)[1].(txvm.Int)) |
| 285 | pubkeyTupleTuple := txIss.Stack[1].(txvm.Tuple) |
| 286 | pubkeyTuple := pubkeyTupleTuple[1].(txvm.Tuple) |
| 287 | for _, p := range pubkeyTuple { |
| 288 | if pubkey, ok := p.(txvm.Bytes); ok { |
| 289 | issuance.Pubkeys = append(issuance.Pubkeys, ed25519.PublicKey(pubkey)) |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | issuance.NonceCallerSeed = nonceTuple[1].(txvm.Bytes) |
| 294 | issuance.NonceSelfSeed = nonceTuple[2].(txvm.Bytes) |
| 295 | issuance.NonceBlockID = nonceTuple[3].(txvm.Bytes) |
| 296 | issuance.NonceExpMS = int64(nonceTuple[4].(txvm.Int)) |
| 297 | |
| 298 | issuance.TimerangeMinMS = int64(timerangeTuple[2].(txvm.Int)) |
| 299 | issuance.TimerangeMaxMS = int64(timerangeTuple[3].(txvm.Int)) |
| 300 | |
| 301 | issuance.RefData = []byte(refdataTuple[2].(txvm.Bytes)) |
| 302 | } |
| 303 | |
| 304 | func addRetireMeta(retirement *Retirement, tx *bc.Tx, logPos int) { |
| 305 | if logPos+1 >= len(tx.Log) { |