Exemple #1
0
 public static SimulatedMevBundle Cancelled(MevBundle bundle) =>
 new SimulatedMevBundle(bundle,
                        0,
                        false,
                        UInt256.Zero,
                        UInt256.Zero,
                        UInt256.Zero);
Exemple #2
0
 public SimulatedMevBundle(
     MevBundle bundle,
     long gasUsed,
     bool success,
     UInt256 bundleFee,
     UInt256 coinbasePayments,
     UInt256 eligibleGasFeePayment)
 {
     Bundle                = bundle;
     GasUsed               = gasUsed;
     Success               = success;
     BundleFee             = bundleFee;
     CoinbasePayments      = coinbasePayments;
     EligibleGasFeePayment = eligibleGasFeePayment;
 }
        private static RlpStream EncodeRlp(MevBundle bundle)
        {
            (int Content, int Tx) GetContentLength()
            {
                int txHashes = Rlp.LengthOfKeccakRlp * bundle.Transactions.Count;
                int content  = Rlp.LengthOf(bundle.BlockNumber) + Rlp.LengthOfSequence(txHashes);

                return(Rlp.LengthOfSequence(content), txHashes);
            }

            (int contentLength, int txLength) = GetContentLength();
            RlpStream stream = new(contentLength);

            stream.StartSequence(contentLength);
            stream.Encode(bundle.BlockNumber);
            stream.StartSequence(txLength);

            for (int i = 0; i < bundle.Transactions.Count; i++)
            {
                stream.Encode(bundle.Transactions[i].Hash);
            }

            return(stream);
        }
        private static Keccak GetHash(MevBundle bundle)
        {
            RlpStream stream = EncodeRlp(bundle);

            return(Keccak.Compute(stream.Data));
        }
 public BundleEventArgs(MevBundle mevBundle)
 {
     MevBundle = mevBundle;
 }