https://github.com/axieinfinity/truffle-deploy
Fine-grained Truffle deployment.
https://github.com/axieinfinity/truffle-deploy
deployment ethereum migration solidity truffle
Last synced: 3 months ago
JSON representation
Fine-grained Truffle deployment.
- Host: GitHub
- URL: https://github.com/axieinfinity/truffle-deploy
- Owner: axieinfinity
- License: mit
- Created: 2018-08-20T19:56:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-21T12:48:12.000Z (over 7 years ago)
- Last Synced: 2025-08-13T15:59:41.645Z (8 months ago)
- Topics: deployment, ethereum, migration, solidity, truffle
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# truffle-deploy
[](./LICENSE) [](https://www.npmjs.com/package/truffle-deploy)
Fine-grained Truffle deployment, with:
* Automatic gas estimation.
* Transaction retries.
* No `Migrations` contract.
## Installation
```sh
npm install --dev truffle-deploy
```
## Usage
Writing a deployment is relatively similar to what you do
with a Truffle migration. You can put your deployments in any directory
you want, but preferably NOT `migrations` since that could cause confusions.
```solidity
// contracts/Ownable.sol
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) external onlyOwner {
owner = _newOwner;
}
}
```
```js
// deployments/001_ownable.js
const assert = require('assert');
module.exports = async ({ accounts, artifacts, deployer, logger, network }) => {
const Ownable = artifacts.require('Ownable.sol');
logger.info(`Hey, I'm running on "${network}".`);
const ownable = await deployer.deploy(Ownable);
assert.equal(await ownable.owner(), accounts[0]);
logger.info('Transferring ownership to another address...');
await deployer.execute(ownable.transferOwnership, accounts[1]);
assert.equal(await ownable.owner(), accounts[1]);
};
```
And then you can run the deployment with:
```sh
npx truffle-deploy deployments/001_ownable.js
```
## Contributing
The project is in an early stage. Currently some basic functionalities
are still lacking (e.g. custom transaction options), so feel free to chime in
and create issues/PRs.
## License
[MIT licensed](./LICENSE).