Factory
A factory is a smart contract that stores a compiled contract on itself, and automatizes deploying it into sub-accounts.
We have two factory examples:
- Token Factory: A factory that creates fungible tokens contracts.
- A Generic Factory: A factory that creates donation contracts, but allows to change the contract it deploys.
thông tin
In this page we will focus on the Donation factory, to learn more about the token factory visit its repository.
Generic Factory
The Generic Factory presents a contract factory that:
- Creates sub-accounts of itself and deploys its contract on them (
create_factory_subaccount_and_deploy
). - Can change the stored contract using the
update_stored_contract
method.
- 🦀 Rust
- deploy.rs
- manager.rs
Loading...
Loading...
Quickstart
Build and Deploy the Factory
You can automatically compile and deploy the contract in the NEAR testnet by running:
./deploy.sh
Once finished, check the neardev/dev-account
file to find the address in which the contract was deployed:
cat ./neardev/dev-account
# e.g. dev-1659899566943-21539992274727