Example #1
0
        public void CreateOrganization(Address from, string ID, string name, byte[] script)
        {
            var Runtime = this;

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

            Runtime.Expect(from == Runtime.GenesisAddress, "must be genesis");
            Runtime.Expect(Runtime.IsWitness(from), "invalid witness");

            Runtime.Expect(ValidationUtils.IsValidIdentifier(ID), "invalid organization name");

            Runtime.Expect(!Nexus.OrganizationExists(RootStorage, ID), "organization already exists");

            Nexus.CreateOrganization(RootStorage, ID, name, script);

            Runtime.Notify(EventKind.OrganizationCreate, from, ID);
        }