0

so I was trying to update an entry point with lazify=true.


import smartpy as sp


class testSC(sp.Contract):
    def __init__(self):
        self.update_initial_storage(
            x=sp.mutez(0))

    @sp.entry_point(lazify = False)
    def update_function(self, ep):
      sp.set_entry_point("f1", ep)

    @sp.entry_point(lazify = True)
    def f1(self):
        x = 5

    
@sp.add_test(name="TestSC")
def test():

    # deploy a contract
    c1 = testSC()
    sc = sp.test_scenario()
    sc += c1
    
    sc.h2("Update the contract")

    def f1(self, batch):
        x = 10
        sp.emit("event",tag="test")
        
    
    c1.update_function(sp.utils.wrap_entry_point("f1", f1))
    

I am trying to update the function f1 . But I am unable to upgrade the function as the new code of the function consists of event(I copied michelson code of the new f1() from smartpy and give it as a param in update_function() at better-call. But it says "Invalid primitive EMIT") . However if I remove the event code, then the f1 function is being upgraded. so how can i update a function by adding event on it?

1 Answer 1

0

The problem is related to better-call.dev. Apperently it has not been updated yet to support the EMIT.

You can update your entrypoint using the SmartPy explorer: https://smartpy.io/explorer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.