Exemplo n.º 1
0
 public MessageCall(OpCode type,
                    DataWord energy,
                    DataWord code_address,
                    DataWord endowment,
                    DataWord in_data_offset,
                    DataWord in_data_size,
                    DataWord out_data_offset,
                    DataWord out_data_size,
                    DataWord tokenId,
                    bool is_token_transfer)
     : this(type, energy, code_address, endowment, in_data_offset, in_data_size, tokenId, is_token_transfer)
 {
     this.out_data_offset = out_data_offset;
     this.out_data_size   = out_data_size;
 }
Exemplo n.º 2
0
 public MessageCall(OpCode type,
                    DataWord energy,
                    DataWord code_address,
                    DataWord endowment,
                    DataWord in_data_offset,
                    DataWord in_data_size,
                    DataWord token_id,
                    bool is_token_transfer)
 {
     this.type              = type;
     this.energy            = energy;
     this.code_address      = code_address;
     this.endowment         = endowment;
     this.in_data_offset    = in_data_offset;
     this.in_data_size      = in_data_size;
     this.token_id          = token_id;
     this.is_token_transfer = is_token_transfer;
 }
Exemplo n.º 3
0
 public static PrecompiledContract getContractForAddress(DataWord address)
 {
     if (address == null)
     {
         return(identity);
     }
     if (address.Equals(ecrecover_address))
     {
         return(ecrecover);
     }
     if (address.Equals(sha256_address))
     {
         return(sha256);
     }
     if (address.Equals(ripempd160_address))
     {
         return(ripempd160);
     }
     if (address.Equals(identity_address))
     {
         return(identity);
     }
     if (address.Equals(modexp_address))
     {
         return(modexp);
     }
     if (address.Equals(addition_address))
     {
         return(addition);
     }
     if (address.Equals(multiplication_address))
     {
         return(multiplication);
     }
     if (address.Equals(pairing_address))
     {
         return(pairing);
     }
     return(null);
 }
Exemplo n.º 4
0
            public override KeyValuePair <bool, byte[]> Execute(byte[] data)
            {
                byte[] h = new byte[32];
                byte[] v = new byte[32];
                byte[] r = new byte[32];
                byte[] s = new byte[32];

                DataWord out_val = null;

                try
                {
                    Array.Copy(data, 0, h, 0, 32);
                    Array.Copy(data, 32, v, 0, 32);
                    Array.Copy(data, 64, r, 0, 32);

                    int length = data.Length < 128 ? data.Length - 96 : 32;
                    Array.Copy(data, 96, s, 0, length);

                    ECDSASignature signature = ECDSASignature.FromComponents(r, s, v[31]);
                    if (ValidateV(v) && signature.IsValidComponents)
                    {
                        out_val = new DataWord(ECKey.SignatureToAddress(h, signature));
                    }
                }
                catch
                {
                }

                if (out_val == null)
                {
                    return(new KeyValuePair <bool, byte[]>(true, new byte[0]));
                }
                else
                {
                    return(new KeyValuePair <bool, byte[]>(true, out_val.Data));
                }
            }
Exemplo n.º 5
0
 public void AddDeleteAccount(DataWord address)
 {
     this.delete_account.Add(address);
 }