示例#1
0
 internal override void InternalInitialize(ISmartContractBridgeContext bridgeContext)
 {
     if (Context != null)
     {
         throw new InvalidOperationException();
     }
     Context       = new CSharpSmartContractContext(bridgeContext);
     State.Context = Context;
 }
示例#2
0
 public void InternalInitialize(ISmartContractBridgeContext context)
 {
     _methodInternalInitialize(context);
 }
示例#3
0
 internal abstract void InternalInitialize(ISmartContractBridgeContext bridgeContext);
示例#4
0
 public void InternalInitialize(ISmartContractBridgeContext context)
 {
     _methodInfos[nameof(InternalInitialize)].Invoke(_instance, new object[] { context });
 }
 public static void SendVirtualInline(this ISmartContractBridgeContext context, Hash fromVirtualAddress,
                                      Address toAddress, string methodName, IMessage message)
 {
     context.SendVirtualInline(fromVirtualAddress, toAddress, methodName,
                               ConvertToByteString(message));
 }
示例#6
0
 public CSharpSmartContractContext(ISmartContractBridgeContext smartContractBridgeContextImplementation)
 {
     _smartContractBridgeContextImplementation = smartContractBridgeContextImplementation;
 }
示例#7
0
 /// <summary>
 /// Converts a virtual address to a contract address with the currently running contract address.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <param name="virtualAddress">The virtual address that want to convert.</param>
 /// <returns></returns>
 public static Address ConvertVirtualAddressToContractAddressWithContractHashName(
     this ISmartContractBridgeContext @this, Hash virtualAddress)
 {
     return(@this.ConvertVirtualAddressToContractAddressWithContractHashName(virtualAddress, @this.Self));
 }
 public static T Call <T>(this ISmartContractBridgeContext context, Address address,
                          string methodName, IMessage message) where T : IMessage <T>, new()
 {
     return(context.Call <T>(address, methodName, ConvertToByteString(message)));
 }
示例#9
0
 /// <summary>
 /// Generate a hash type id based on the address and the bytes.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <param name="address">The address on which the id generation is based.</param>
 /// <param name="token">The hash type token on which the id generation is based.</param>
 /// <returns>The generated hash type id.</returns>
 public static Hash GenerateId(this ISmartContractBridgeContext @this, Address address, Hash token)
 {
     return(@this.GenerateId(address, token));
 }
示例#10
0
 /// <summary>
 /// Generate a hash type id based on the currently running contract address.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <returns>The generated hash type id.</returns>
 public static Hash GenerateId(this ISmartContractBridgeContext @this)
 {
     return(@this.GenerateId(@this.Self, null));
 }
示例#11
0
 /// <summary>
 /// Generate a hash type id based on the currently running contract address and the hash type token.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <param name="token">The hash type token on which the id generation is based.</param>
 /// <returns>The generated hash type id.</returns>
 public static Hash GenerateId(this ISmartContractBridgeContext @this, Hash token)
 {
     return(@this.GenerateId(@this.Self, token.Value));
 }
示例#12
0
 /// <summary>
 /// Generate a hash type id based on the currently running contract address and the token.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <param name="token">The token on which the id generation is based.</param>
 /// <returns>The generated hash type id.</returns>
 public static Hash GenerateId(this ISmartContractBridgeContext @this, string token)
 {
     return(@this.GenerateId(@this.Self, token.GetBytes()));
 }
示例#13
0
 /// <summary>
 /// Generate a hash type id based on the currently running contract address and the bytes.
 /// </summary>
 /// <param name="this">An instance of <see cref="ISmartContractBridgeContext"/>.</param>
 /// <param name="bytes">The bytes on which the id generation is based.</param>
 /// <returns>The generated hash type id.</returns>
 public static Hash GenerateId(this ISmartContractBridgeContext @this, IEnumerable <byte> bytes)
 {
     return(@this.GenerateId(@this.Self, bytes));
 }