Skip to content
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

A issue about the springboard contract invoke transfer #1735

Closed
ProDog opened this issue Jun 29, 2020 · 4 comments · Fixed by neo-project/neo-node#613
Closed

A issue about the springboard contract invoke transfer #1735

ProDog opened this issue Jun 29, 2020 · 4 comments · Fixed by neo-project/neo-node#613
Labels
Question Used in questions

Comments

@ProDog
Copy link
Contributor

ProDog commented Jun 29, 2020

Now Native Nep5Token Transfer allows the springboard contract to invoke the transfer, the inspection condition in code is:

if (!from.Equals(engine.CallingScriptHash) && !engine.CheckWitnessInternal(from))
    return false;

So other contract can transfer any number assets if the transaction included the from's signature.

Like this contract:

        public static bool Transfer(byte[] from, byte[] to, BigInteger amount)
        {
            var balance_neo = Native.NEO("balanceOf", new object[] { from }); 

            Native.NEO("transfer", new object[] { from, myAddress, balance_neo });          
            return true;
        }
@ProDog ProDog added the Question Used in questions label Jun 29, 2020
@Tommo-L
Copy link
Contributor

Tommo-L commented Jun 29, 2020

If we don't allow other contract to call transfer method, then we need CNEO & CGAS again?

@shargon
Copy link
Member

shargon commented Jun 29, 2020

They can use cosigner and sign only for this contract, not for NEO or GAS

@erikzhang
Copy link
Member

erikzhang commented Jun 29, 2020

That's why we need cosigners. If you don't need springboard, you can use WitnessScope.CalledByEntry.

@Tommo-L
Copy link
Contributor

Tommo-L commented Jun 30, 2020

See neo-project/neo-node@dcd8446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Used in questions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants