Example #1
0
    public static QueryTickerEvent Serdes(QueryTickerEvent e, AssetMapping mapping, ISerializer s)
    {
        if (s == null)
        {
            throw new ArgumentNullException(nameof(s));
        }
        e ??= new QueryTickerEvent();
        e.Operation = s.EnumU8(nameof(Operation), e.Operation);
        e.Immediate = s.UInt8(nameof(Immediate), e.Immediate);
        int zeroes = s.UInt8(null, 0);

        zeroes    += s.UInt8(null, 0);
        e.TickerId = TickerId.SerdesU16(nameof(TickerId), e.TickerId, mapping, s);
        // field 8 is the next event id when the condition is false and is deserialised as part of the BranchEventNode that this event should belong to.

        s.Assert(zeroes == 0, "QueryTickerEvent: Expected fields 3,4 to be 0");
        return(e);
    }
Example #2
0
        public static SetTickerEvent Serdes(SetTickerEvent e, AssetMapping mapping, ISerializer s)
        {
            if (s == null)
            {
                throw new ArgumentNullException(nameof(s));
            }

            e ??= new SetTickerEvent();
            e.Operation = s.EnumU8(nameof(Operation), e.Operation);
            e.Amount    = s.UInt8(nameof(Amount), e.Amount);
            e.Unk4      = s.UInt8(nameof(Unk4), e.Unk4);
            e.Unk5      = s.UInt8(nameof(Unk5), e.Unk5);
            e.TickerId  = TickerId.SerdesU16(nameof(TickerId), e.TickerId, mapping, s);
            e.Unk8      = s.UInt16(nameof(Unk8), e.Unk8);
            ApiUtil.Assert(e.Unk4 == 0 || e.Unk4 == 1);
            ApiUtil.Assert(e.Unk5 == 0);
            ApiUtil.Assert(e.Unk8 == 0);
            return(e);
        }
Example #3
0
    public static TickerEvent Serdes(TickerEvent e, AssetMapping mapping, ISerializer s)
    {
        if (s == null)
        {
            throw new ArgumentNullException(nameof(s));
        }

        e ??= new TickerEvent();
        e.Operation = s.EnumU8(nameof(Operation), e.Operation);
        e.Amount    = s.UInt8(nameof(Amount), e.Amount);
        e.Unk4      = s.UInt8(nameof(Unk4), e.Unk4);
        int zeroed = s.UInt8(null, 0);

        e.TickerId = TickerId.SerdesU16(nameof(TickerId), e.TickerId, mapping, s);
        zeroed    += s.UInt16(null, 0);
        ApiUtil.Assert(e.Unk4 is 0 or 1);
        s.Assert(zeroed == 0, "TickerEvent: Expected fields 5, 8 to be 0");
        return(e);
    }