Last active
May 23, 2018 20:14
-
-
Save mseijas/9e93947af1428dc878592dd260eb7c2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SocialNetworkProxy = artifacts.require('SocialNetworkProxy') | |
const SocialNetworkV1 = artifacts.require('SocialNetworkV1') | |
const SocialNetworkV2 = artifacts.require('SocialNetworkV2') | |
module.exports = (deployer, network, accounts) => { | |
deployer.then(async () => { | |
/*********************************** | |
* 1. INITIAL DEPLOYMENT | |
***********************************/ | |
let proxy, socialNetworkV1, proxySocialNetwork | |
// 1. Deploy SocialNetworkProxy | |
proxy = await deployer.deploy(SocialNetworkProxy) | |
// 2. Deploy SocialNetworkV1 contract | |
socialNetworkV1 = await deployer.deploy(SocialNetworkV1) | |
// 3. Link SocialNetworkProxy with SocialNetworkV1 contract | |
await proxy.upgradeTo(socialNetworkV1.address) | |
// 4. Update ImageURL via Proxy | |
proxySocialNetwork = SocialNetworkV1.at(proxy.address) | |
await proxySocialNetwork.setName('TanookiChats') | |
await proxySocialNetwork.setImageUrl('http://tanookilabs.com/images/[email protected]') | |
// /*********************************** | |
// * 2. UPGRADE TO SOCIALNETWORKV2 | |
// ***********************************/ | |
let socialNetworkV2 | |
// 1. Deploy SocialNetworkV2 contract | |
socialNetworkV2 = await deployer.deploy(SocialNetworkV2) | |
// 2. Upgrade proxy to SocialNetworkV2 | |
await proxy.upgradeTo(socialNetworkV2.address) | |
// 3. Add an account as an admin | |
proxySocialNetwork = SocialNetworkV2.at(proxy.address) | |
await proxySocialNetwork.addAdminAccount(accounts[2]) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment