Near-One / near-plugins

Implementation of common patterns used for NEAR smart contracts.
Creative Commons Zero v1.0 Universal
27 stars 12 forks source link

feat(Upgradable)!: enable batched fn call after deploy #86

Closed mooori closed 1 year ago

mooori commented 1 year ago

Closes #76 and this external issue.

Adds an additional parameter to Upgradable::up_deploy_code that allows to optionally specify a function call to be batched with the code deployment. This might be a function that migrates state. If that function call fails, the deployment is rolled back and the old code remains active.

Breaking change

This is a breaking change since it modifies the signature of Upgradable::up_deploy_code. Users that want to maintain the previous behavior (deployment without function call) can migrate in the following way:

// Previously:
up_deploy_code()

// Same behavior with the new API:
up_deploy_code(None)