forked from cerc-io/ipld-eth-server
Add transaction index to flip kick
This commit is contained in:
parent
a843de5eb7
commit
b2ba7ee1e3
@ -8,5 +8,6 @@ CREATE TABLE maker.flip_kick (
|
|||||||
"end" TIMESTAMP WITH TIME ZONE,
|
"end" TIMESTAMP WITH TIME ZONE,
|
||||||
urn VARCHAR,
|
urn VARCHAR,
|
||||||
tab NUMERIC,
|
tab NUMERIC,
|
||||||
|
tx_idx INTEGER NOT NUll,
|
||||||
raw_log JSONB
|
raw_log JSONB
|
||||||
);
|
);
|
||||||
|
@ -233,6 +233,7 @@ CREATE TABLE maker.flip_kick (
|
|||||||
"end" timestamp with time zone,
|
"end" timestamp with time zone,
|
||||||
urn character varying,
|
urn character varying,
|
||||||
tab numeric,
|
tab numeric,
|
||||||
|
tx_idx integer NOT NULL,
|
||||||
raw_log jsonb
|
raw_log jsonb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ func (FlipKickConverter) ToEntity(contractAddress string, contractAbi string, et
|
|||||||
return entity, err
|
return entity, err
|
||||||
}
|
}
|
||||||
entity.Raw = ethLog
|
entity.Raw = ethLog
|
||||||
|
entity.TransactionIndex = ethLog.TxIndex
|
||||||
return entity, nil
|
return entity, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +80,7 @@ func (FlipKickConverter) ToModel(flipKick FlipKickEntity) (FlipKickModel, error)
|
|||||||
End: end,
|
End: end,
|
||||||
Urn: urn,
|
Urn: urn,
|
||||||
Tab: tab,
|
Tab: tab,
|
||||||
|
TransactionIndex: flipKick.TransactionIndex,
|
||||||
Raw: rawLogString,
|
Raw: rawLogString,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,6 @@ type FlipKickEntity struct {
|
|||||||
End *big.Int
|
End *big.Int
|
||||||
Urn [32]byte
|
Urn [32]byte
|
||||||
Tab *big.Int
|
Tab *big.Int
|
||||||
|
TransactionIndex uint
|
||||||
Raw types.Log
|
Raw types.Log
|
||||||
}
|
}
|
||||||
|
@ -24,5 +24,6 @@ type FlipKickModel struct {
|
|||||||
End time.Time
|
End time.Time
|
||||||
Urn string
|
Urn string
|
||||||
Tab string
|
Tab string
|
||||||
|
TransactionIndex uint `db:"tx_idx"`
|
||||||
Raw string `db:"raw_log"`
|
Raw string `db:"raw_log"`
|
||||||
}
|
}
|
||||||
|
@ -35,18 +35,13 @@ func NewFlipKickRepository(db *postgres.DB) FlipKickRepository {
|
|||||||
}
|
}
|
||||||
func (fkr FlipKickRepository) Create(headerId int64, flipKick FlipKickModel) error {
|
func (fkr FlipKickRepository) Create(headerId int64, flipKick FlipKickModel) error {
|
||||||
_, err := fkr.DB.Exec(
|
_, err := fkr.DB.Exec(
|
||||||
`INSERT into maker.flip_kick (header_id, id, lot, bid, gal, "end", urn, tab, raw_log)
|
`INSERT into maker.flip_kick (header_id, id, lot, bid, gal, "end", urn, tab, tx_idx, raw_log)
|
||||||
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)`,
|
VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`,
|
||||||
headerId, flipKick.Id, flipKick.Lot, flipKick.Bid, flipKick.Gal, flipKick.End, flipKick.Urn, flipKick.Tab, flipKick.Raw,
|
headerId, flipKick.Id, flipKick.Lot, flipKick.Bid, flipKick.Gal, flipKick.End, flipKick.Urn, flipKick.Tab, flipKick.TransactionIndex, flipKick.Raw,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fkr FlipKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
func (fkr FlipKickRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
|
||||||
var result []core.Header
|
var result []core.Header
|
||||||
err := fkr.DB.Select(
|
err := fkr.DB.Select(
|
||||||
|
@ -71,6 +71,7 @@ var _ = Describe("FlipKick Repository", func() {
|
|||||||
Expect(dbResult.End.Equal(flipKick.End)).To(BeTrue())
|
Expect(dbResult.End.Equal(flipKick.End)).To(BeTrue())
|
||||||
Expect(dbResult.Urn).To(Equal(flipKick.Urn))
|
Expect(dbResult.Urn).To(Equal(flipKick.Urn))
|
||||||
Expect(dbResult.Tab).To(Equal(flipKick.Tab))
|
Expect(dbResult.Tab).To(Equal(flipKick.Tab))
|
||||||
|
Expect(dbResult.TransactionIndex).To(Equal(flipKick.TransactionIndex))
|
||||||
Expect(dbResult.Raw).To(MatchJSON(flipKick.Raw))
|
Expect(dbResult.Raw).To(MatchJSON(flipKick.Raw))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ var EthFlipKickLog = types.Log{
|
|||||||
Data: hexutil.MustDecode(flipKickData),
|
Data: hexutil.MustDecode(flipKickData),
|
||||||
BlockNumber: uint64(FlipKickBlockNumber),
|
BlockNumber: uint64(FlipKickBlockNumber),
|
||||||
TxHash: common.HexToHash(flipKickTransactionHash),
|
TxHash: common.HexToHash(flipKickTransactionHash),
|
||||||
TxIndex: 0,
|
TxIndex: 999,
|
||||||
BlockHash: common.HexToHash(flipKickBlockHash),
|
BlockHash: common.HexToHash(flipKickBlockHash),
|
||||||
Index: 0,
|
Index: 0,
|
||||||
Removed: false,
|
Removed: false,
|
||||||
@ -75,6 +75,7 @@ var FlipKickEntity = flip_kick.FlipKickEntity{
|
|||||||
End: big.NewInt(end),
|
End: big.NewInt(end),
|
||||||
Urn: urn,
|
Urn: urn,
|
||||||
Tab: tab,
|
Tab: tab,
|
||||||
|
TransactionIndex: EthFlipKickLog.TxIndex,
|
||||||
Raw: EthFlipKickLog,
|
Raw: EthFlipKickLog,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ var FlipKickModel = flip_kick.FlipKickModel{
|
|||||||
End: time.Unix(end, 0),
|
End: time.Unix(end, 0),
|
||||||
Urn: urnString,
|
Urn: urnString,
|
||||||
Tab: tabString,
|
Tab: tabString,
|
||||||
|
TransactionIndex: EthFlipKickLog.TxIndex,
|
||||||
Raw: rawLogString,
|
Raw: rawLogString,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user