コード例 #1
0
ファイル: Validator.cs プロジェクト: rjumawan/tzkt
        protected async Task ValidateActivation(RawActivationContent activation)
        {
            if (await Cache.Accounts.ExistsAsync(activation.Address, AccountType.User) &&
                ((await Cache.Accounts.GetAsync(activation.Address)) as User).Activated == true)
            {
                throw new ValidationException("account is already activated");
            }

            if ((activation.Metadata.BalanceUpdates[0] as ContractUpdate)?.Contract != activation.Address)
            {
                throw new ValidationException($"invalid activation balance updates");
            }
        }
コード例 #2
0
ファイル: ActivationsCommit.cs プロジェクト: rjumawan/tzkt
        public async Task Init(Block block, RawOperation op, RawActivationContent content)
        {
            var account = (User)await Cache.Accounts.GetAsync(content.Address);

            account.Delegate ??= Cache.Accounts.GetDelegate(account.DelegateId);

            Activation = new ActivationOperation
            {
                Id        = Cache.AppState.NextOperationId(),
                Block     = block,
                Level     = block.Level,
                Timestamp = block.Timestamp,
                OpHash    = op.Hash,
                Account   = account,
                Balance   = content.Metadata.BalanceUpdates[0].Change
            };
        }
コード例 #3
0
ファイル: ActivationsCommit.cs プロジェクト: rjumawan/tzkt
        public static async Task <ActivationsCommit> Apply(ProtocolHandler proto, Block block, RawOperation op, RawActivationContent content)
        {
            var commit = new ActivationsCommit(proto);
            await commit.Init(block, op, content);

            await commit.Apply();

            return(commit);
        }