-
I'm newcomer to NEAR , before i'm develop a smart contract at Ethereum using Solidity, and i've been familiar with factory pattern from there, just for simple explanation about factory pattern itself is we can "clone" smart contract with different contract's address, we can deploy multiple contract's instance from some contract. I'm using this pattern when found a usecase when a user need their own contract. One user one contract, and it's specific only for a single user, for example maintain user's inventory. Actually the inventory contract itself is always same between users, but rather than a single inventory contract that maintain mapping for each users, we just deploy an inventory contract for each user, so each user has their own inventory. Ref:
The question is, is it possible to implement this pattern at NEAR's contract ? Of course using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes. You can refer to test_promise_batch_deploy_call method of https://github.com/near/near-sdk-js/blob/develop/tests/src/promise_batch_api.js function. It's a contract that deploying the given contract bytes. |
Beta Was this translation helpful? Give feedback.
Yes. You can refer to test_promise_batch_deploy_call method of https://github.com/near/near-sdk-js/blob/develop/tests/src/promise_batch_api.js function. It's a contract that deploying the given contract bytes.
The example looks ugly - have to provide the other contract's binary content (wasm) in a JS string and that can be extremely long. We're going to add a utility to allow
include(filename)
in the build process to make it a lot cleaner