Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #45 from rnsdomains/addr-registrar-migrations
Browse files Browse the repository at this point in the history
Create FIFS Addr deployment script
  • Loading branch information
ilanolkies authored Feb 3, 2020
2 parents 501ca63 + 7cf9e5e commit f07cd41
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
23 changes: 19 additions & 4 deletions migrations/1_rsk_owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const TokenRegistrar = artifacts.require('TokenRegistrar');
const RSKOwner = artifacts.require('RSKOwner');
const NamePrice = artifacts.require('NamePrice');
const FIFSRegistrar = artifacts.require('FIFSRegistrar');
const FIFSAddrRegistrar = artifacts.require('FIFSAddrRegistrar');
const BytesUtils = artifacts.require('BytesUtils');
const Renewer = artifacts.require('Renewer');

Expand All @@ -21,18 +22,20 @@ const namehash = require('eth-ens-namehash').hash;
*/
function deployDev (deployer, accounts) {
const POOL = accounts[1];
let rns, rif, tokenRegistrar, rskOwner, namePrice, fifsRegistrar, renewer;
let rns, rif, tokenRegistrar, rskOwner, namePrice, fifsRegistrar, fifsAddrRegistrar, renewer;

const devAddress = '0x2824b21e348d520a50cddfa77ba158822160dd94';

const rootNode = namehash('rsk');

const label = web3.utils.sha3('javiesses');
const amount = web3.utils.toBN('1000000000000000000');

return deployer.deploy(RNS).then(_rns => {
rns = _rns;
})
.then(() => {
return deployer.deploy(RIF, accounts[0], web3.utils.toBN('1000000000000000000000'));
return deployer.deploy(RIF, accounts[0], web3.utils.toBN('1000000000000000000000'), 'RIFOS', 'RIF', web3.utils.toBN('18'));
})
.then(_rif => {
rif = _rif;
Expand All @@ -41,7 +44,7 @@ function deployDev (deployer, accounts) {
return rif.transfer(devAddress, web3.utils.toBN('100000000000000000000'));
})
.then(() => {
return deployer.deploy(TokenRegistrar, rns.address, namehash('rsk'), rif.address);
return deployer.deploy(TokenRegistrar, rns.address, rootNode, rif.address);
})
.then(_tokenRegistrar => {
tokenRegistrar = _tokenRegistrar;
Expand Down Expand Up @@ -87,7 +90,7 @@ function deployDev (deployer, accounts) {
return tokenRegistrar.transfer(label, devAddress);
})
.then(() => {
return deployer.deploy(RSKOwner, tokenRegistrar.address, rns.address, namehash('rsk'));
return deployer.deploy(RSKOwner, tokenRegistrar.address, rns.address, rootNode);
})
.then(_rskOwner => {
rskOwner = _rskOwner;
Expand All @@ -107,6 +110,9 @@ function deployDev (deployer, accounts) {
.then(() => {
return deployer.link(BytesUtils, FIFSRegistrar);
})
.then(() => {
return deployer.link(BytesUtils, FIFSAddrRegistrar);
})
.then(() => {
return deployer.deploy(FIFSRegistrar, rif.address, rskOwner.address, POOL, namePrice.address);
})
Expand All @@ -116,6 +122,15 @@ function deployDev (deployer, accounts) {
.then(() => {
return rskOwner.addRegistrar(fifsRegistrar.address);
})
.then(() => {
return deployer.deploy(FIFSAddrRegistrar, rif.address, rskOwner.address, POOL, namePrice.address, rns.address, rootNode);
})
.then(_fifsAddrRegistrar => {
fifsAddrRegistrar = _fifsAddrRegistrar;
})
.then(() => {
return rskOwner.addRegistrar(fifsAddrRegistrar.address);
})
.then(() => {
return deployer.link(BytesUtils, Renewer);
})
Expand Down
35 changes: 35 additions & 0 deletions migrations/3_addr_registrar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const BytesUtils = artifacts.require('BytesUtils');
const FIFSAddrRegistrar = artifacts.require('FIFSAddrRegistrar');
const namehash = require('eth-ens-namehash').hash;

module.exports = (deployer, network, accounts) => {
if (network === 'testnet') {
BytesUtils.address = '0x7faf084ef72cb71f3383a5c568c70853ac4c298e';
deployer.link(BytesUtils, FIFSAddrRegistrar).then(() => {
return deployer.deploy(
FIFSAddrRegistrar,
'0x19f64674d8a5b4e652319f5e239efd3bc969a1fe', // rif
'0xca0a477e19bac7e0e172ccfd2e3c28a7200bdb71', // node owner
accounts[0], // pool
'0x794f99f1a9382ba88b453ddb4bfa00acae8d50e8', // name price
'0x7d284aaac6e925aad802a53c0c69efe3764597b8', // rns
namehash('rsk'), // root node
);
});
} else if (network === 'mainnet') {
BytesUtils.address = '0xe9e32c20cbce0ad4f16377bd9a84554828e86a06';
deployer.link(BytesUtils, FIFSAddrRegistrar).then(() => {
return deployer.deploy(
FIFSAddrRegistrar,
'0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', // rif
'0x45d3e4fb311982a06ba52359d44cb4f5980e0ef1', // node owner
'0x39e00d2616e792f50ddd33bbe46e8bf55eadebee', // pool
'0xd09adf13e482928e47e96dd6f02aad1daf7a5a47', // name price
'0xcb868aeabd31e2b66f74e9a55cf064abb31a4ad5', // rns
namehash('rsk'), // root node
).then(addrRegistrar => {
return addrRegistrar.transferOwnership('0x39e00d2616e792f50ddd33bbe46e8bf55eadebee')
});
});
}
}

0 comments on commit f07cd41

Please sign in to comment.