-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from JoinColony/extension-upgrade-notification
Notification for ExtensionUpgrade to v6 of VotingReputation contract
- Loading branch information
Showing
4 changed files
with
81 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "_active", | ||
"type": "bool" | ||
} | ||
], | ||
"name": "getReputationMiningCycle", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "repMiningCycleAddress", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
"constant": true | ||
}, | ||
{ | ||
"anonymous": false, | ||
"inputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "_active", | ||
"type": "bool" | ||
} | ||
], | ||
"name": "getReputationMiningCycle", | ||
"outputs": [ | ||
"indexed": true, | ||
"internalType": "bytes32", | ||
"name": "extensionId", | ||
"type": "bytes32" | ||
}, | ||
{ | ||
"indexed": true, | ||
"internalType": "address", | ||
"name": "colony", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "repMiningCycleAddress", | ||
"type": "address" | ||
"indexed": false, | ||
"internalType": "uint256", | ||
"name": "version", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function", | ||
"constant": true | ||
} | ||
] | ||
], | ||
"name": "ExtensionUpgraded", | ||
"type": "event" | ||
} | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { ethers } = require('ethers') | ||
const colonyABI = require('./abis/IColonyNetwork.json') | ||
|
||
// #Skunkworks Channel | ||
const SKUNKWORKS_CHANNEL = process.env.SKUNKWORKS_DISCORD_CHANNEL | ||
// Colony Contract Address | ||
const NETWORK_ADDRESS = process.env.NETWORK_ADDRESS | ||
// Gnosis Chain RPC URL | ||
const RPC_URL = process.env.RPC_URL | ||
// Ping Admin User | ||
const DISCORD_USER_ID = process.env.UPGRADE_ALERT_DISCORD_USER_ID | ||
|
||
module.exports = robot => { | ||
const channel = robot.client.channels.cache.get(SKUNKWORKS_CHANNEL) | ||
const provider = new ethers.providers.JsonRpcProvider(RPC_URL) | ||
const contract = new ethers.Contract(NETWORK_ADDRESS, colonyABI, provider) | ||
|
||
contract.on("ExtensionUpgraded", (extensionId, colonyAddress, version) => { | ||
if (version.toString() === '6' && extensionId === '0xdc951b3d4193c331186bc2de3b4e659e51d8b00ef92751ae69abaa48a6ab38dd') { | ||
message = 'Extension Upgraded in Colony: ' + colonyAddress | ||
channel.send(`<@${DISCORD_USER_ID}> ` + message) | ||
} | ||
}) | ||
|
||
} |