コード例 #1
0
        public bool MigrateMember(RuntimeVM Runtime, Address admin, Address from, Address to)
        {
            Runtime.Expect(Runtime.IsRootChain(), "must be root chain");

            if (to.IsSystem)
            {
                Runtime.Expect(to != this.Address, "can't add organization as member of itself");
            }

            var list = GetMemberList();

            if (!list.Contains <Address>(from))
            {
                return(false);
            }

            Runtime.Expect(!list.Contains <Address>(to), "target address is already a member of organization");

            list.Remove <Address>(from);
            list.Add <Address>(to);

            Runtime.Notify(EventKind.OrganizationRemove, admin, new OrganizationEventData(this.ID, from));
            Runtime.Notify(EventKind.OrganizationAdd, admin, new OrganizationEventData(this.ID, to));

            return(true);
        }
コード例 #2
0
        public bool AddMember(RuntimeVM Runtime, Address from, Address target)
        {
            if (from.IsSystem)
            {
                Runtime.Expect(from != this.Address, "can't add organization as member of itself");
            }

            Runtime.Expect(Runtime.IsRootChain(), "must be root chain");

            var set = GetMemberSet();

            if (set.Contains <Address>(target))
            {
                return(false);
            }

            set.Add <Address>(target);

            var list = GetMemberList();

            list.Add <Address>(target);

            Runtime.Notify(EventKind.OrganizationAdd, from, new OrganizationEventData(this.ID, target));
            return(true);
        }
コード例 #3
0
        public bool RemoveMember(RuntimeVM Runtime, Address from, Address target)
        {
            Runtime.Expect(Runtime.IsRootChain(), "must be root chain");

            var list = GetMemberList();

            if (!list.Contains <Address>(target))
            {
                return(false);
            }

            list.Remove <Address>(target);

            Runtime.Notify(EventKind.OrganizationRemove, from, new OrganizationEventData(this.ID, target));
            return(true);
        }