Exemplo n.º 1
0
        public void Execute()
        {
            var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7");
            var state = new State(
                ImmutableDictionary <Address, IValue> .Empty
                .Add(AdminState.Address, new AdminState(admin, 100).Serialize())
                .Add(ActivatedAccountsState.Address, new ActivatedAccountsState().Serialize())
                );
            var newComer = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
            var action   = new AddActivatedAccount(newComer);

            IAccountStateDelta nextState = action.Execute(new ActionContext()
            {
                BlockIndex     = 1,
                Miner          = default,
Exemplo n.º 2
0
        public void Execute(bool isAdmin, long blockIndex, bool alreadyActivated, Type exc)
        {
            var admin = new Address("8d9f76aF8Dc5A812aCeA15d8bf56E2F790F47fd7");
            var state = new State(
                ImmutableDictionary <Address, IValue> .Empty
                .Add(AdminState.Address, new AdminState(admin, 100).Serialize())
                );
            var newComer         = new Address("399bddF9F7B6d902ea27037B907B2486C9910730");
            var activatedAddress = newComer.Derive(ActivationKey.DeriveKey);

            if (alreadyActivated)
            {
                state = (State)state.SetState(activatedAddress, true.Serialize());
            }

            var action = new AddActivatedAccount(newComer);
            var signer = isAdmin ? admin : default;

            if (exc is null)
            {
                IAccountStateDelta nextState = action.Execute(new ActionContext()
                {
                    BlockIndex     = blockIndex,
                    Miner          = default,