Skip to content

Commit

Permalink
[Devpack Testing] update artifacts (#1153)
Browse files Browse the repository at this point in the history
* update artifacts

* add missing file

* fix warning
  • Loading branch information
Jim8y authored Aug 26, 2024
1 parent 9bdb9ba commit 57f57f7
Show file tree
Hide file tree
Showing 116 changed files with 211 additions and 779 deletions.
21 changes: 11 additions & 10 deletions src/Neo.SmartContract.Testing/Extensions/ArtifactExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static string GetArtifactsSource(this ContractManifest manifest, string?
sourceCode.WriteLine("");
sourceCode.WriteLine("namespace Neo.SmartContract.Testing;");
sourceCode.WriteLine("");
sourceCode.WriteLine($"public abstract class {name} : " + string.Join(", ", inheritance) + ", IContractInfo");
sourceCode.WriteLine($"public abstract class {name}({typeof(SmartContractInitialize).FullName} initialize) : " + FormatInheritance(inheritance, "initialize") + ", IContractInfo");
sourceCode.WriteLine("{");

// Write compiled data
Expand Down Expand Up @@ -172,14 +172,6 @@ public static string GetArtifactsSource(this ContractManifest manifest, string?
sourceCode.WriteLine();
}

// Create constructor

sourceCode.WriteLine(" #region Constructor for internal use only");
sourceCode.WriteLine();
sourceCode.WriteLine($" protected {name}({typeof(SmartContractInitialize).FullName} initialize) : base(initialize) {{ }}");
sourceCode.WriteLine();
sourceCode.WriteLine(" #endregion");

sourceCode.WriteLine("}");

return sourceCode.ToString();
Expand Down Expand Up @@ -369,7 +361,7 @@ private static string CreateSourceMethodFromManifest(ContractMethodDescriptor me

if (isLast && arg.Type == ContractParameterType.Any)
{
// it will be object X, we can add a default value
// it will be `object X`, we can add a default value

sourceCode.Write($"{TypeToSource(arg.Type)} {EscapeName(arg.Name)} = null");
}
Expand Down Expand Up @@ -436,5 +428,14 @@ private static string TypeToSource(ContractParameterType type)
_ => "object?",
};
}

private static string FormatInheritance(List<Type> inheritance, string initializeParam)
{
var formattedInheritance = inheritance.Select(type => (type == typeof(SmartContract)
? $"{type.FullName}({initializeParam})"
: type.FullName)!)
.ToList();
return string.Join(", ", formattedInheritance);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract1 : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract1(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -59,9 +59,4 @@ public abstract class Contract1 : Neo.SmartContract.Testing.SmartContract, ICont

#endregion

#region Constructor for internal use only

protected Contract1(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract2 : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract2(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract2 : Neo.SmartContract.Testing.SmartContract, ICont

#endregion

#region Constructor for internal use only

protected Contract2(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ABIAttributes : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ABIAttributes(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_ABIAttributes : Neo.SmartContract.Testing.SmartCo

#endregion

#region Constructor for internal use only

protected Contract_ABIAttributes(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ABIAttributes2 : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ABIAttributes2(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_ABIAttributes2 : Neo.SmartContract.Testing.SmartC

#endregion

#region Constructor for internal use only

protected Contract_ABIAttributes2(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ABIAttributes3 : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ABIAttributes3(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_ABIAttributes3 : Neo.SmartContract.Testing.SmartC

#endregion

#region Constructor for internal use only

protected Contract_ABIAttributes3(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ABISafe : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ABISafe(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -44,9 +44,4 @@ public abstract class Contract_ABISafe : Neo.SmartContract.Testing.SmartContract

#endregion

#region Constructor for internal use only

protected Contract_ABISafe(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Abort : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Abort(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -59,9 +59,4 @@ public abstract class Contract_Abort : Neo.SmartContract.Testing.SmartContract,

#endregion

#region Constructor for internal use only

protected Contract_Abort(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Array : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Array(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -143,9 +143,4 @@ public abstract class Contract_Array : Neo.SmartContract.Testing.SmartContract,

#endregion

#region Constructor for internal use only

protected Contract_Array(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Assert : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Assert(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -53,9 +53,4 @@ public abstract class Contract_Assert : Neo.SmartContract.Testing.SmartContract,

#endregion

#region Constructor for internal use only

protected Contract_Assert(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_AttributeChanged : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_AttributeChanged(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_AttributeChanged : Neo.SmartContract.Testing.Smar

#endregion

#region Constructor for internal use only

protected Contract_AttributeChanged(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_BigInteger : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_BigInteger(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -179,9 +179,4 @@ public abstract class Contract_BigInteger : Neo.SmartContract.Testing.SmartContr

#endregion

#region Constructor for internal use only

protected Contract_BigInteger(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Boolean : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Boolean(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_Boolean : Neo.SmartContract.Testing.SmartContract

#endregion

#region Constructor for internal use only

protected Contract_Boolean(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ByteArrayAssignment : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ByteArrayAssignment(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -53,9 +53,4 @@ public abstract class Contract_ByteArrayAssignment : Neo.SmartContract.Testing.S

#endregion

#region Constructor for internal use only

protected Contract_ByteArrayAssignment(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Char : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Char(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -119,9 +119,4 @@ public abstract class Contract_Char : Neo.SmartContract.Testing.SmartContract, I

#endregion

#region Constructor for internal use only

protected Contract_Char(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_CheckedUnchecked : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_CheckedUnchecked(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -47,9 +47,4 @@ public abstract class Contract_CheckedUnchecked : Neo.SmartContract.Testing.Smar

#endregion

#region Constructor for internal use only

protected Contract_CheckedUnchecked(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ComplexAssign : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ComplexAssign(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -83,9 +83,4 @@ public abstract class Contract_ComplexAssign : Neo.SmartContract.Testing.SmartCo

#endregion

#region Constructor for internal use only

protected Contract_ComplexAssign(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_Concat : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_Concat(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand Down Expand Up @@ -47,9 +47,4 @@ public abstract class Contract_Concat : Neo.SmartContract.Testing.SmartContract,

#endregion

#region Constructor for internal use only

protected Contract_Concat(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Neo.SmartContract.Testing;

public abstract class Contract_ConcatByteStringAddAssign : Neo.SmartContract.Testing.SmartContract, IContractInfo
public abstract class Contract_ConcatByteStringAddAssign(Neo.SmartContract.Testing.SmartContractInitialize initialize) : Neo.SmartContract.Testing.SmartContract(initialize), IContractInfo
{
#region Compiled data

Expand All @@ -29,9 +29,4 @@ public abstract class Contract_ConcatByteStringAddAssign : Neo.SmartContract.Tes

#endregion

#region Constructor for internal use only

protected Contract_ConcatByteStringAddAssign(Neo.SmartContract.Testing.SmartContractInitialize initialize) : base(initialize) { }

#endregion
}
Loading

0 comments on commit 57f57f7

Please sign in to comment.