Hot answers tagged

2

Stored lambdas approach: It allows any packable value as a parameter and the method that computes the new value can be updated. import smartpy as sp class Upgradable(sp.Contract): def __init__(self, **kargs): self.init(**kargs) @sp.entry_point def calc(self, data): self.data.value = self.data.logic(data) @sp.entry_point def updateLogic(...


1

You could do something like this: Or just store upgradable structures as bytes and lambdas to unpack/pack and process those bytes. (Expensive and doesn't work with big maps) Is it feasible to this without giving the admin developer too much power? No, having an upgradable contract means that the contract can change its behavior to do unintended things. ...


1

Another way is dependency injection: the upgradable contract takes as a parameter a contract address or a lambda that is called. The caller can thus "upgrade" the original contract by varying the supplied address / lambda. The pro is also the con of this approach: it allows the the contract client to interact with the contract in ways the contract ...


Only top voted, non community-wiki answers of a minimum length are eligible