-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/nep5 updates #18
Conversation
It is better to create a new NEP for this update. |
We should continue to use NEP5 because people associate 'NEP5' as the token format and there has been limited implementation. If we create another NEP for these changes, it will be very confusing to developers about which standard to use. We should attempt to maintain a standard, singular message about what the token standard is unless there are substantial changes. The changes proposed in the PR are not substantial. In fact, all of the functionality already exists in the current NEP5. Another option is to use the notation NEP5.1 to include these changes. This would indicate that there have been changes made, but would make it obvious to developers that they should use the new version. |
I agree with @lllwvlvwlll, it would be good to update the existing standard rather than use a new one. |
I have mark it as accepted. Now we need to finish the dynamic invocation proposal first. |
The C# sample implementation is missing the transfer event, can we update the sample to include it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 .. very good
@erikzhang can we merge this ? |
@canesin I suggest that:
|
We can update the ICO Template to add these methods. I don't understand the opposition to requiring these methods in the standard. Why would someone want to spend a lot of GAS to create a token that can't be traded very easily? Could you explain your worry about this? |
We need to keep the token standard as simple as possible, and in fact not all tokens have the need to trade on the decentralized exchange. They only need to implement the most basic transfer functions. |
@erikzhang there are many applications besides decentralized exchanges, anything that need some system to behave as a assignee will need this - platforms like lending , crowd sourcing, freelancing and IoT markets. Having this as optional will create confusion on the ecosystem on why some of the tokens cannot participate on those. These are very simple methods, only 3, that have already been added to the examples. |
I made a demo for DEX without using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services.Neo;
using Neo.SmartContract.Framework.Services.System;
using System;
using System.Numerics;
namespace DEX_Demo
{
public class DEX : SmartContract
{
public static bool Main(string operation, object[] args)
{
switch (Runtime.Trigger)
{
case TriggerType.Verification:
//Ensure that the current transaction is an invocation to this contract.
return true;
case TriggerType.Application:
switch (operation)
{
case "deposit":
return deposit((byte[])args[0], (BigInteger)args[1], (byte[])args[2], (byte[])args[3]);
case "withdraw":
return withdraw((byte[])args[0], (BigInteger)args[1], (byte[])args[2], (byte[])args[3]);
//case "order"://Place orders.
// break;
default:
return false;
}
default:
//Handle direct deposit.
return false;
}
}
public static bool deposit(byte[] asset_id, BigInteger amount, byte[] from, byte[] to)
{
var func = (Func<string, object[], bool>)asset_id.ToDelegate();
if (!func("transfer", new object[] { from, ExecutionEngine.ExecutingScriptHash, amount }))
return false;
byte[] key = to.Concat(asset_id);
BigInteger value = Storage.Get(Storage.CurrentContext, key).AsBigInteger();
Storage.Put(Storage.CurrentContext, key, value + amount);
return true;
}
public static bool withdraw(byte[] asset_id, BigInteger amount, byte[] from, byte[] to)
{
byte[] key = from.Concat(asset_id);
BigInteger value = Storage.Get(Storage.CurrentContext, key).AsBigInteger();
if (value < amount) return false;
var func = (Func<string, object[], bool>)asset_id.ToDelegate();
if (!func("transfer", new object[] { ExecutionEngine.ExecutingScriptHash, to, amount }))
return false;
Storage.Put(Storage.CurrentContext, key, value - amount);
return true;
}
}
} |
This does not provide a standardized interface for interoperable NEP5 tokens. Also, the standard should provide an interface where In this example, only this SC would be able to delegate, since the storage of who did the We should design for this scenario:
|
@erikzhang I noticed you mentioned But while we can know that the transaction is of Reference: https://github.com/neo-project/neo/blob/master/neo/SmartContract/StateReader.cs |
We can use |
This allows smart contracts to check that the transaction is an invocation to the same contract during verification phase. Example use case: neo-project/proposals#18 (comment)
This allows checking that a transaction is an invocation to the same smart contract during verification phase. Example usage: neo-project/proposals#18 (comment)
This allows checking that a transaction is an invocation to the same smart contract during verification phase. Example usage: neo-project/proposals#18 (comment)
This allows checking that a transaction is an invocation to the same smart contract during verification phase. Example usage: neo-project/proposals#18 (comment)
This allows smart contracts to check that the transaction is an invocation to the same contract during verification phase. Example use case: neo-project/proposals#18 (comment)
This allows checking that a transaction is an invocation to the same smart contract during verification phase. Example usage: neo-project/proposals#18 (comment)
[deleted] |
Here's an alternative, concrete approach to the one I suggested previously: #40 This based on the work Joe Stewart has done with Non-Fungbile Token Extensions to NEP-5 and the work I've done to support NEP-5 extensions for Requisitions. Looking forward to your feedback. |
Changes optional methods to required to enable contract interactions