Neo: A issue about the springboard contract invoke transfer

Created on 29 Jun 2020  路  4Comments  路  Source: neo-project/neo

Now Native Nep5Token Transfer allows the springboard contract to invoke the transfer, the inspection condition in code is:
```C#
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:
```C#        
        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;
        }
question

Most helpful comment

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

All 4 comments

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garrey332 picture garrey332  路  3Comments

realloc picture realloc  路  4Comments

igormcoelho picture igormcoelho  路  3Comments

igormcoelho picture igormcoelho  路  4Comments

shargon picture shargon  路  3Comments