• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bmresearch / Solnet / 13115350420

03 Feb 2025 02:09PM UTC coverage: 72.123% (-5.4%) from 77.499%
13115350420

push

github

BifrostTitan
Updated Governance program -- Example uses legacy mango markets DAO

1118 of 1754 branches covered (63.74%)

Branch coverage included in aggregate %.

0 of 11 new or added lines in 6 files covered. (0.0%)

5130 of 6909 relevant lines covered (74.25%)

1222547.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Solnet.Programs/Governance/Models/ProposalOption.cs
1
using Solnet.Programs.Governance.Enums;
2
using Solnet.Programs.Utilities;
3
using System;
4
using System.Collections.Generic;
5
using System.Linq;
6
using System.Text;
7
using System.Threading.Tasks;
8

9
namespace Solnet.Programs.Governance.Models
10
{
11
    /// <summary>
12
    /// Proposal Option
13
    /// </summary>
14
    public class ProposalOption
15
    {
16
        /// <summary>
17
        /// The layout of the structure.
18
        /// </summary>
19
        public static class Layout
20
        {
21
            /// <summary>
22
            /// The length of the structure without taking into account the label string.
23
            /// </summary>
24
            public const int LengthWithoutLabel = 23;
25

26
            /// <summary>
27
            /// The offset at which the label string begins.
28
            /// </summary>
29
            public const int LabelOffset = 0;
30
        }
31

32
        /// <summary>
33
        /// Option label
34
        /// </summary>
35
        public string Label;
36

37
        /// <summary>
38
        /// The length of the label. This value is used for deserialization purposes.
39
        /// </summary>
40
        internal int LabelLength;
41

42
        /// <summary>
43
        /// Vote weight for the option
44
        /// </summary>
45
        public ulong VoteWeight;
46

47
        /// <summary>
48
        /// Vote result for the option
49
        /// </summary>
50
        public OptionVoteResult VoteResult;
51

52
        /// <summary>
53
        /// The number of the instructions already executed
54
        /// </summary>
55
        public ushort InstructionsExecutedCount;
56

57
        /// <summary>
58
        /// The number of instructions included in the option
59
        /// </summary>
60
        public ushort InstructionsCount;
61

62
        /// <summary>
63
        /// The index of the the next instruction to be added
64
        /// </summary>
65
        public ushort InstructionsNextIndex;
66

67
        /// <summary>
68
        /// Deserialize the data into the <see cref="ProposalOption"/> structure.
69
        /// </summary>
70
        /// <param name="data">The data to deserialize.</param>
71
        /// <returns>The <see cref="ProposalOption"/> structure.</returns>
72
        public static ProposalOption Deserialize(ReadOnlySpan<byte> data)
73
        {
NEW
74
            int labelLength = data.GetBorshString(Layout.LabelOffset, out string label);
×
75

76
            return new ProposalOption
×
77
            {
×
78
                Label = label,
×
79
                LabelLength = labelLength,
×
80
                VoteWeight = data.GetU64(labelLength),
×
81
                VoteResult = (OptionVoteResult)Enum.Parse(typeof(OptionVoteResult), data.GetU8(sizeof(ulong) + labelLength).ToString()),
×
82
                InstructionsExecutedCount = data.GetU16(sizeof(byte) + sizeof(ulong) + labelLength),
×
83
                InstructionsCount = data.GetU16(sizeof(byte) + sizeof(ulong) + sizeof(ushort) + labelLength),
×
84
                InstructionsNextIndex = data.GetU16(sizeof(byte) + sizeof(ulong) + (sizeof(ushort) * 2) + labelLength),
×
85
            };
×
86
        }
87
    }
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc