Skip to content

Enable and improve libraries #207

@mikhailUshakoff

Description

@mikhailUshakoff

Abstract

This document describes the storage and utilization of library functions for use in smart contracts.

Motivation

At present, smart contract developers store all smart contract code in a single account. Consequently, they are compelled to repeatedly upload redundant code to the blockchain. If an error or suboptimal code is found within a function, developers must update all smart contracts using that function.

Specifications

Add the following functionality:

  • Each account can add/modify/delete library functions if the corresponding logic is implemented within it.

  • Each account pays the storage fee for its own library functions.

  • Each account using libraries pays gas fees for loading and executing library functions.

  • Libraries stored on the master chain are visible on the master chain and on work chains.

  • Libraries stored on a work chain are visible only to that work chain.

Changes at the blockchain state level

  • The key of the library is considered to be a hash of the initial code and the account address.

  • Limit the number of libraries per account to 250.

  • Store libraries for workchains.

Changes at the VM level

  • Create instructions for updating library code.

Changes at the account level

No changes required.

Cost of storing the library

No changes required.

Cost of loading and using the library

No changes required.

Library upload process

No changes required.

Library modification process

No changes required.

Library usage process

No changes required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions