示例#1
0
        //[{"type":"Hash160","value":"0xf621168b1fce3a89c33a5f6bcf7e774b4657031c"},{"type":"PublicKey","value":"0222d8515184c7d62ffa99b829aeb4938c4704ecb0dd7e340e842e9df121826343"}]
        public static void NeoCall(UInt160 account, ECPoint publicKey)
        {
            OnNotify(NEO.Name);

            OnNotify(NEO.Symbol);

            OnNotify(NEO.Decimals);

            OnNotify(NEO.TotalSupply());

            OnNotify(NEO.BalanceOf(account));

            OnNotify(NEO.UnclaimedGas(account, Blockchain.GetHeight()));

            OnNotify(NEO.GetCandidates());

            OnNotify(NEO.GetCommittee());

            OnNotify(NEO.GetNextBlockValidators());

            OnNotify(NEO.RegisterCandidate(publicKey));

            OnNotify(NEO.UnregisterCandidate(publicKey));

            OnNotify(NEO.Vote(account, publicKey));

            OnNotify(NEO.Transfer((UInt160)account, Owner, 1000));

            OnNotify(NEO.GetGasPerBlock());

            OnNotify(NEO.SetGasPerBlock(300000000));

            OnNotify(NEO.GetGasPerBlock());
        }
示例#2
0
        protected override void OnPersist(ApplicationEngine engine)
        {
            base.OnPersist(engine);
            foreach (Transaction tx in engine.Snapshot.PersistingBlock.Transactions)
            {
                Burn(engine, tx.Sender, tx.SystemFee + tx.NetworkFee);
            }
            ECPoint[] validators = NEO.GetNextBlockValidators(engine.Snapshot);
            UInt160   primary    = Contract.CreateSignatureRedeemScript(validators[engine.Snapshot.PersistingBlock.ConsensusData.PrimaryIndex]).ToScriptHash();

            Mint(engine, primary, engine.Snapshot.PersistingBlock.Transactions.Sum(p => p.NetworkFee));
        }
示例#3
0
 internal override async ContractTask OnPersist(ApplicationEngine engine)
 {
     long totalNetworkFee = 0;
     foreach (Transaction tx in engine.PersistingBlock.Transactions)
     {
         await Burn(engine, tx.Sender, tx.SystemFee + tx.NetworkFee);
         totalNetworkFee += tx.NetworkFee;
     }
     ECPoint[] validators = NEO.GetNextBlockValidators(engine.Snapshot, engine.ProtocolSettings.ValidatorsCount);
     UInt160 primary = Contract.CreateSignatureRedeemScript(validators[engine.PersistingBlock.PrimaryIndex]).ToScriptHash();
     await Mint(engine, primary, totalNetworkFee, false);
 }
示例#4
0
        internal override void OnPersist(ApplicationEngine engine)
        {
            long totalNetworkFee = 0;

            foreach (Transaction tx in engine.PersistingBlock.Transactions)
            {
                Burn(engine, tx.Sender, tx.SystemFee + tx.NetworkFee);
                totalNetworkFee += tx.NetworkFee;
            }
            ECPoint[] validators = NEO.GetNextBlockValidators(engine.Snapshot);
            UInt160   primary    = Contract.CreateSignatureRedeemScript(validators[engine.PersistingBlock.ConsensusData.PrimaryIndex]).ToScriptHash();

            Mint(engine, primary, totalNetworkFee, false);
        }
示例#5
0
文件: GasToken.cs 项目: eryeer/neoUT
        protected override bool OnPersist(ApplicationEngine engine)
        {
            if (!base.OnPersist(engine))
            {
                return(false);
            }
            foreach (Transaction tx in engine.Snapshot.PersistingBlock.Transactions)
            {
                Burn(engine, tx.Sender, tx.SystemFee + tx.NetworkFee);
            }
            ECPoint[] validators = NEO.GetNextBlockValidators(engine.Snapshot);
            UInt160   primary    = Contract.CreateSignatureRedeemScript(validators[engine.Snapshot.PersistingBlock.ConsensusData.PrimaryIndex]).ToScriptHash();

            Mint(engine, primary, engine.Snapshot.PersistingBlock.Transactions.Sum(p => p.NetworkFee));
            BigInteger sys_fee = GetSysFeeAmount(engine.Snapshot, engine.Snapshot.PersistingBlock.Index - 1) + engine.Snapshot.PersistingBlock.Transactions.Sum(p => p.SystemFee);
            StorageKey key     = CreateStorageKey(Prefix_SystemFeeAmount, BitConverter.GetBytes(engine.Snapshot.PersistingBlock.Index));

            engine.Snapshot.Storages.Add(key, new StorageItem
            {
                Value      = sys_fee.ToByteArrayStandard(),
                IsConstant = true
            });
            return(true);
        }