@stdlib/deploy
Provides unified mechanisms for deployments.
To use this library, import @stdlib/deploy:
import "@stdlib/deploy";Messages
Deploy
message Deploy {
    queryId: Int as uint64;
}DeployOk
message DeployOk {
    queryId: Int as uint64;
}FactoryDeploy
message FactoryDeploy {
    queryId: Int as uint64;
    cashback: Address;
}Traits
Deployable
Simplest trait Deployable that provides a handy unified mechanism for deployments by implementing a simple receiver for the Deploy message.
All contracts are deployed by sending them a message. While any message can be used for this purpose, best practice is to use the special Deploy message.
This message has a single field, queryId, provided by the deployer (usually set to zero). If the deployment succeeds, the contract will reply with a DeployOk message and echo the same queryId in the response.
Source code:
trait Deployable {
    receive(deploy: Deploy) {
        self.notify(DeployOk{queryId: deploy.queryId}.toCell());
    }
}Usage example:
import "@stdlib/deploy";
 
contract ExampleContract with Deployable {
    // Now, this contract has a receiver for Deploy message
}FactoryDeployable
Trait FactoryDeployable provides a handy unified mechanism for chained deployments.
Source code:
trait FactoryDeployable  {
    receive(deploy: FactoryDeploy) {
        self.forward(deploy.cashback, DeployOk{queryId: deploy.queryId}.toCell(), false, null);
    }
}Usage example:
import "@stdlib/deploy";
 
contract ExampleContract with FactoryDeployable {
    // Now, this contract has a receiver for FactoryDeploy message
}