neo-project / examples Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
To whom it may concern,
I checked out repos at the latest commit 3544cc42d4c9c8f868ce22dca51f83af0fccf744
When building ICO_Template project this error occurs:
1>------ Rebuild All started: Project: ICO_Template, Configuration: Debug Any CPU ------
1> ICO_Template -> C:\workspace\examples-csharp\ICO_Template\bin\Debug\ICO_Template.dll
1> Start NeoContract converter, Source File: C:\workspace\examples-csharp\ICO_Template\bin\Debug\ICO_Template.dll
1> Neo.Compiler.MSIL console app v2.0.3.0
1>CONVERTTASK : LoadModule error : System.Exception: can't parese event type from:System.Action`3<System.Byte[],System.Byte[],System.Numerics.BigInteger>.maybe it is System.Action<xxx> which is defined in mscorlib.dll,copy this dll in.
1> at Neo.Compiler.MSIL.ILField..ctor(ILType type, FieldDefinition field)
1> at Neo.Compiler.MSIL.ILType..ctor(ILModule module, TypeDefinition type)
1> at Neo.Compiler.MSIL.ILModule.LoadModule(Stream dllStream, Stream pdbStream)
1> at Neo.Compiler.Program.Main(String[] args)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
My system specs:
Windows 10 Education
MS Visual Studio Professional 2017 - Version 15.4.5
MS .NET Framework Version 4.7.02053
Could you please take a look into this issue?
One more thing, I'm new in NEO world and looking for a tutorial/example to implement an ICO, like https://aphelion.org/
Is there any more detailed example/tutorial for newbie to understand and follow?
Many thanks,
It is possible to overfund the ICO with the current code.
The current MintTokens() method checks using CurrentSwapRate() whether or not Total_Supply >= Total_Amount however it doesn't check if receiving this incoming NEO asset will take the Total_Supply over the amount raised.
This has the unlikely but possible situation that the last person to input assets could have sent a huge amount of NEO which means they will overfund the ICO and receive loads of tokens.
I have a fix for this so raising this as an issue which I've been working on.
did it thank you
c:\examples-csharp-master\ICO_Template 的目录
2017/12/18 12:05 <DIR> .
2017/12/18 12:05 <DIR> ..
2017/12/18 13:32 <DIR> bin
2017/10/18 00:16 199 build.tasks
2017/10/18 00:16 9,976 ICO_Template.cs
2017/10/18 00:16 2,707 ICO_Template.csproj
2017/10/18 00:16 6,656 Neo.ConvertTask.dll
2017/12/18 13:32 <DIR> obj
2017/10/18 00:16 152 packages.config
2017/12/18 12:04 <DIR> Properties
5 个文件 19,690 字节
5 个目录 16,678,305,792 可用字节
c:\examples-csharp-master\ICO_Template>msbuild
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 15.5.180.51428
版权所有(C) Microsoft Corporation。保留所有权利。
生成启动时间为 2017/12/18 13:39:33。
节点 1 上的项目“c:\examples-csharp-master\ICO_Template\ICO_Template.csproj”(默认目标)。
GenerateTargetFrameworkMonikerAttribute:
正在跳过目标“GenerateTargetFrameworkMonikerAttribute”,因为所有输出文件相对于输入文件而言都是最新的。
CoreCompile:
正在跳过目标“CoreCompile”,因为所有输出文件相对于输入文件而言都是最新的。
_CopyFilesMarkedCopyLocal:
正在对“c:\examples-csharp-master\ICO_Template\obj\Debug\ICO_Template.csproj.CopyComplete”执行 Touch 任务。
CopyFilesToOutputDirectory:
ICO_Template -> c:\examples-csharp-master\ICO_Template\bin\Debug\ICO_Template.dll
AfterBuild:
Start NeoContract converter, Source File: c:\examples-csharp-master\ICO_Template\bin\Debug\ICO_Template.dll
已完成生成项目“c:\examples-csharp-master\ICO_Template\ICO_Template.csproj”(默认目标)的操作 - 失败。
生成失败。
0 个警告
0 个错误
已用时间 00:00:01.39
I'm getting "System.InvalidOperationException: Stack empty." error when compiling the ICO template project.
My .net framework version is 4.7.1 and I've already copied mscorlib.dll to the ICO_Template\bin\Debug folder.
Start NeoContract converter, Source File: E:\nep17test\bin\Debug\net5.0\FJBC.dll
Neo.Compiler.MSIL console app v3.0.0.0
EXEC : Convert error : System.Exception: error:System.Void FJBC.NEP17::Mint(System.Numerics.BigInteger)::IL_0047 Call Neo.SmartContract.Framework.IScriptContainer Neo.SmartContract.Framework.Services.System.ExecutionEngine::get_ScriptContainer()(43) [E:\nep17test\FJBC.csproj]
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Neo.Compiler.MSIL.ModuleConverter.TryInsertMethod(NeoModule outModule, MethodDefinition method) in C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Conv_Multi.cs:line 1175
at Neo.Compiler.MSIL.ModuleConverter.ConvertCall(OpCode src, NeoMethod to, List`1 methodTokens) in C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Conv_Multi.cs:line 772
at Neo.Compiler.MSIL.ModuleConverter.ConvertCode(ILMethod method, OpCode src, NeoMethod to) in C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Converter.cs:line 805
at Neo.Compiler.MSIL.ModuleConverter.FillMethod(ILMethod from, NeoMethod to, Boolean withReturn) in
C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Converter.cs:line 277
--- End of inner exception stack trace ---
at Neo.Compiler.MSIL.ModuleConverter.FillMethod(ILMethod from, NeoMethod to, Boolean withReturn) in
C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Converter.cs:line 281
at Neo.Compiler.MSIL.ModuleConverter.Convert(ILModule _in, ConvOption option) in C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\MSIL\Converter.cs:line 124
at Neo.Compiler.Program.Compile(Options options, ILogger log) in C:\Users\erik\source\repos\neo-project\neo-devpack-dotnet\src\Neo.Compiler.MSIL\Program.cs:line 165
... ...
I've tried everything I can think of to create a VB.NET version of the C# template, but I always end up with something like this in the output:
1>CONVERTTASK : Convert error : System.Exception: unknown call:System.String ExternalTest.TestFunctions::Main()
1> at Neo.Compiler.MSIL.ModuleConverter._ConvertCall(OpCode src, AntsMethod to)
1> at Neo.Compiler.MSIL.ModuleConverter.ConvertCode(ILMethod method, OpCode src, AntsMethod to)
1> at Neo.Compiler.MSIL.ModuleConverter.ConvertMethod(ILMethod from, AntsMethod to)
1> at Neo.Compiler.MSIL.ModuleConverter.Convert(ILModule _in)
1> at Neo.Compiler.Program.Main(String[] args)
[DisplayName("Oracle Demo")]
Since default name "" will not be accepted by neo-core.
You mentioned the contract for intelligent deployment to block chain for other people to call in the intelligent contract document, how to deploy?
Json object not recognizable, should update to: (neo-project/neo#2298)
object ret = StdLib.JsonDeserialize(result)
return Transfer((string)args[0], (byte[])args[1], (byte[])args[2], (byte[])args[2]);
should probably be
return Transfer((string)args[0], (byte[])args[1], (byte[])args[2], (byte[])args[3]);
Hi - it would really help a lot to get struct deserialize from byte[]. Serialize to byte[] is nice to have. Structs have limited user otherwise or they take a lot of effort to decode. Protobuf would be nice? Thanks.
Hi!
I'm trying to call the NEO Oracle using the sample smart contract below:
using Neo.SmartContract.Framework.Services;
using Neo.SmartContract.Framework.Attributes;
using Neo.SmartContract.Framework.Native;
using System;
namespace Neo.SmartContract.Examples
{
[ManifestExtra("Author", "Neo")]
[ManifestExtra("Email", "[email protected]")]
[ManifestExtra("Description", "This is an oracle example")]
public class OracleDemo : Framework.SmartContract
{
public static void doRequest()
{
string url = "https://raw.githubusercontent.com/neo-project/examples/master/csharp/Oracle/example.json"; // the content is { "value": "hello world" }
string filter = "$.value"; // JSONPath format https://github.com/atifaziz/JSONPath
string callback = "callback"; // callback method
object userdata = "userdata"; // arbitrary type
long gasForResponse = Oracle.MinimumResponseFee;`
Oracle.Request(url, filter, callback, userdata, gasForResponse);
}
public static void callback(string url, string userdata, OracleResponseCode code, string result)
{
if (Runtime.CallingScriptHash != Oracle.Hash) throw new Exception("Unauthorized!");
if (code != OracleResponseCode.Success) throw new Exception("Oracle response failure with code " + (byte)code);
object ret = StdLib.JsonDeserialize(result); // [ "hello world" ]
object[] arr = (object[])ret;
string value = (string)arr[0];
Runtime.Log("userdata: " + userdata);
Runtime.Log("response value: " + value);
}
}
}
However, I'm getting a message that the Oracle is failing: "Oracle response failure with code "
Per asking people on Discord, the key issue is that the Oracle website isn't setting Content-Type header to application/json
. Instead its setting it to text/plain; charset=utf-8
. Per the blockchain explorer, transaction had an exception VMState == FAULT error is ContentTypeNotSupported
.
However, I cannot make this change from my end, it needs to be done from the website.
Can someone here please confirm that this is the root cause of the error, and if so, provide a work-around or fix the problem directly on the Oracle website? For reference, my smart contract is deployed on TestNet here, if you'd like to test it directly:
Thanks,
I see the below errors. Please help me.
Using neo.smartcontract.framework\3.0.0-preview5
error CS0246: The type or namespace name 'ContractPermissionAttribute' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ContractPermission' could not be found (are you missing a using directive or an assembly reference?)
https://github.com/neo-project/examples-csharp/blob/master/ICO_Template/ICO_Template.cs does not comply with the NEP-5 specification. For example all of the public NEP-5 methods should start with a lower case letter. There's issues with the lettercasing of the transfer event.
The sample also contains operations and methods that are extraneous to the NEP-5 specification.
The sample doesn't comply with NEP-10 in light of the above.
Reference:
neo-project/proposals#33
https://raw.githubusercontent.com/neo-project/examples/master/csharp/Oracle/example.json return text/plain type response, default is application/json type.
Due to current limitations it is not currently possible to get the return value out to see if the Domain smart contract is working properly e.g. (have you registered a Domain or transferred it).
The solution is to use Runtime.Log, I am working on amending the code to be able to add the logging in which will help people understand their smart contracts.
requires: using Neo.SmartContract.Framework.Attributes;
this problem is present in different code sections in the documentation, not just this file.
Neo.Smartcontract.Framework v3.0.0-rc2 has changed a lot. All of the N3 examples out of date ...
This repository is outdated and duplicates the one here https://github.com/neo-project/neo-devpack-dotnet/tree/master/examples
Set this repository to archive?
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 “ConvertTask”任务返回了 false,但未记录错误。 NEP5 E:\D\C#\GitHubDesktop\examples\csharp\NEP5\NEP5.csproj 64
Hi, I want to implement a token for ICO base on NEO, so follow this template.
After getting avm
file, I deployed and invoked deploy
method as described in this guide.
I followed the tutorial carefully and no error occurred. But my token just does not appear in testnet's assets list. I also see in the test net there's no asset that has type NEP5
now.
I want to implement a token like APH in main net, but don't have any clues how to make it now.
Did I miss any step? Or NEP5
token is not available in test net?
Best regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.