LSP7DigitalAsset
deploy
lspFactory.LSP7DigitalAsset.deploy(digitalAssetProperties [, options]);
Deploys a mintable LSP7 Digital Asset.
info
By default LSPFactory deploys the Mintable
implementation of LSP7 digital assets. To call the mint
function import the LSP7Mintable
abi from the lsp-smart-contracts library.
Parameters
1. digitalAssetProperties
- Object
Specify properties to be set on the LSP7 Digital Asset during deployment.
Name | Type | Description |
---|---|---|
name | String | The name of the token. Passed to the LSP7 smart contract as a constructor parameter |
symbol | String | The symbol of the token. Passed to the LSP7 smart contract as a constructor parameter |
controllerAddress | String | The owner of the contract. Passed to the LSP7 smart contract constructor parameter |
isNFT | Boolean | Specify if the token should be fungible by setting the LSP7 decimals value to 18. Passed to the LSP7 smart contract as a constructor parameter |
digitalAssetMetadata (optional) | Object | String | The LSP4 metadata to be attached to the smart contract. |
creators (optional) | Array | The LSP4 metadata to be attached to the smart contract. |
2. options
- Object (optional)
Object which specifies how the LSP7 Digital Asset will be deployed
Name | Type | Description |
---|---|---|
LSP7DigitalAsset (optional) | String | Generic contract configuration object. Takes version and deployProxy parameters. |
onDeployEvents (optional) | Object | Pass next , complete and error callback handlers to be executed as deployment events are fired. See Reactive Deployment . |
ipfsGateway (optional) | String | Object | An IPFS gateway URL or an object containing IPFS configuration options. |
info
You can read more about the options
object specification on its official page
Returns
Type | Description |
---|---|
Promise | Resolves to an object containing deployed contract details. |
Example
Deploying an LSP7 Digital Asset
await lspFactory.LSP7DigitalAsset.deploy({
name: 'My token',
symbol: 'TKN',
controllerAddress: '0xb74a88C43BCf691bd7A851f6603cb1868f6fc147',
isNFT: true,
});
/**
{
LSP7DigitalAsset: {
address: '0x32208e331d023c2ABcdfD160Ee25B97219aEfCD9',
receipt: {
to: null,
from: '0x9Fba07e245B415cC9580BD6c890a9fd7D22e20db',
contractAddress: '0x32208e331d023c2ABcdfD160Ee25B97219aEfCD9',
transactionIndex: 0,
gasUsed: [BigNumber],
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
blockHash: '0x1b44bd472b1b202620a78847138692828149e7f692763c884d99a9adf0b8a94c',
transactionHash: '0xe923acc3431ef24fc11103b53b4219611d0f72e59734fc3c7db8da3eb4564844',
logs: [],
blockNumber: 12028918,
confirmations: 1,
cumulativeGasUsed: [BigNumber],
status: 1,
type: 0,
byzantium: true,
events: []
}
}
}
*/
Reactive LSP7 Digital Asset deployment Example
Deploying a Reactive LSP7 Digital Asset
await lspFactory.LSP7DigitalAsset.deploy(
{
name: 'My token',
symbol: 'TKN',
controllerAddress: '0xb74a88C43BCf691bd7A851f6603cb1868f6fc147',
isNFT: true,
},
{
onDeployEvents: {
next: (deploymentEvent) => {
console.log(deploymentEvent);
},
error: (error) => {
console.error(error);
},
complete: (contracts) => {
console.log('Deployment Complete');
console.log(contracts.LSP7DigitalAsset);
},
},
},
);
/**
{
type: 'PROXY_DEPLOYMENT',
contractName: 'LSP7DigitalAsset',
status: 'PENDING',
transaction: {
...
}
}
{
type: 'PROXY_DEPLOYMENT',
contractName: 'LSP7DigitalAsset',
status: 'COMPLETE',
contractAddress: '0x97053C386eaa49d6eAD7477220ca04EFcD857dde',
receipt: {
...
}
}
{
type: 'TRANSACTION',
contractName: 'LSP7DigitalAsset',
functionName: 'initialize(string,string,address,bool)',
status: 'PENDING',
transaction: {
...
}
}
{
type: 'TRANSACTION',
contractName: 'LSP7DigitalAsset',
functionName: 'initialize(string,string,address,bool)',
status: 'COMPLETE',
receipt: {
...
}
}
{
type: 'TRANSACTION',
contractName: 'LSP7DigitalAsset',
functionName: 'setDataBatch(bytes32[],bytes[])',
status: 'PENDING',
transaction: {
...
}
}
{
type: 'TRANSACTION',
contractName: 'LSP7DigitalAsset',
functionName: 'setDataBatch(bytes32[],bytes[])',
status: 'COMPLETE',
receipt: {
...
}
}
{
type: 'TRANSACTION',
status: 'PENDING',
contractName: 'LSP7DigitalAsset',
functionName: 'transferOwnership(address)',
transaction: {
...
}
}
{
type: 'TRANSACTION',
contractName: 'LSP7DigitalAsset',
functionName: 'transferOwnership(address)',
status: 'COMPLETE',
receipt: {
...
}
}
Deployment Complete
{
address: '0x97053C386eaa49d6eAD7477220ca04EFcD857dde',
receipt: {
...
},
}
*/