func testSNativeCALL(t *testing.T, expectPass bool, blockCache *BlockCache, doug *acm.Account, snativeAddress, data []byte, f func([]byte) error) { if expectPass { perm, err := ptypes.PermStringToFlag(TrimmedString(snativeAddress)) if err != nil { t.Fatal(err) } doug.Permissions.Base.Set(perm, true) } var addr []byte contractCode := callContractCode(snativeAddress) doug.Code = contractCode blockCache.UpdateAccount(doug) addr = doug.Address tx, _ := types.NewCallTx(blockCache, user[0].PubKey, addr, data, 100, 10000, 100) tx.Sign(chainID, user[0]) fmt.Println("subscribing to", types.EventStringAccCall(snativeAddress)) ev, exception := execTxWaitEvent(t, blockCache, tx, types.EventStringAccCall(snativeAddress)) if exception == ExceptionTimeOut { t.Fatal("Timed out waiting for event") } if expectPass { if exception != "" { t.Fatal("Unexpected exception", exception) } evv := ev.(types.EventDataCall) ret := evv.Return if err := f(ret); err != nil { t.Fatal(err) } } else { if exception == "" { t.Fatal("Expected exception") } } }