setfulfillmentpermission_script.js
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
let ethers = require('ethers') | |
let provider = new ethers.providers.JsonRpcProvider(process.env.KOVAN_RPC_URL) | |
let oracleAddress = '0xCAB9Ba909AfC195F9B5a4323631cBA2f7D1609EC' | |
let oracleAbi = [ | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_sender", | |
"type": "address" | |
}, | |
{ | |
"name": "_payment", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_specId", | |
"type": "bytes32" | |
}, | |
{ | |
"name": "_callbackAddress", | |
"type": "address" | |
}, | |
{ | |
"name": "_callbackFunctionId", | |
"type": "bytes4" | |
}, | |
{ | |
"name": "_nonce", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_dataVersion", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_data", | |
"type": "bytes" | |
} | |
], | |
"name": "oracleRequest", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_requestId", | |
"type": "bytes32" | |
}, | |
{ | |
"name": "_payment", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_callbackAddress", | |
"type": "address" | |
}, | |
{ | |
"name": "_callbackFunctionId", | |
"type": "bytes4" | |
}, | |
{ | |
"name": "_expiration", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_data", | |
"type": "bytes32" | |
} | |
], | |
"name": "fulfillOracleRequest", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "EXPIRY_TIME", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "withdrawable", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_requestId", | |
"type": "bytes32" | |
}, | |
{ | |
"name": "_payment", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_callbackFunc", | |
"type": "bytes4" | |
}, | |
{ | |
"name": "_expiration", | |
"type": "uint256" | |
} | |
], | |
"name": "cancelOracleRequest", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [], | |
"name": "renounceOwnership", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_node", | |
"type": "address" | |
}, | |
{ | |
"name": "_allowed", | |
"type": "bool" | |
} | |
], | |
"name": "setFulfillmentPermission", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "owner", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_sender", | |
"type": "address" | |
}, | |
{ | |
"name": "_amount", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_data", | |
"type": "bytes" | |
} | |
], | |
"name": "onTokenTransfer", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "_node", | |
"type": "address" | |
} | |
], | |
"name": "getAuthorizationStatus", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_newOwner", | |
"type": "address" | |
} | |
], | |
"name": "transferOwnership", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_recipient", | |
"type": "address" | |
}, | |
{ | |
"name": "_amount", | |
"type": "uint256" | |
} | |
], | |
"name": "withdraw", | |
"outputs": [], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"inputs": [ | |
{ | |
"name": "_link", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "constructor" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "specId", | |
"type": "bytes32" | |
}, | |
{ | |
"indexed": false, | |
"name": "requester", | |
"type": "address" | |
}, | |
{ | |
"indexed": false, | |
"name": "requestId", | |
"type": "bytes32" | |
}, | |
{ | |
"indexed": false, | |
"name": "payment", | |
"type": "uint256" | |
}, | |
{ | |
"indexed": false, | |
"name": "callbackAddr", | |
"type": "address" | |
}, | |
{ | |
"indexed": false, | |
"name": "callbackFunctionId", | |
"type": "bytes4" | |
}, | |
{ | |
"indexed": false, | |
"name": "cancelExpiration", | |
"type": "uint256" | |
}, | |
{ | |
"indexed": false, | |
"name": "dataVersion", | |
"type": "uint256" | |
}, | |
{ | |
"indexed": false, | |
"name": "data", | |
"type": "bytes" | |
} | |
], | |
"name": "OracleRequest", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "requestId", | |
"type": "bytes32" | |
} | |
], | |
"name": "CancelOracleRequest", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "previousOwner", | |
"type": "address" | |
} | |
], | |
"name": "OwnershipRenounced", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "previousOwner", | |
"type": "address" | |
}, | |
{ | |
"indexed": true, | |
"name": "newOwner", | |
"type": "address" | |
} | |
], | |
"name": "OwnershipTransferred", | |
"type": "event" | |
} | |
] | |
let wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) | |
let oracle = new ethers.Contract(oracleAddress, oracleAbi, wallet) | |
let gasPrice = 30000000000 | |
const main = async () => { | |
let overrides = { | |
gasPrice: 30000000000 | |
} | |
let address = "0x643315C9Be056cDEA171F4e7b2222a4ddaB9F88D" | |
let contractWithSigner = oracle.connect(wallet) | |
// set the address here to the node wallet address (regular address not emergency) | |
let tx = await contractWithSigner.setFulfillmentPermission(address, true, overrides) | |
await tx.wait() | |
let authStatus = await contractWithSigner.getAuthorizationStatus(address) | |
console.log(authStatus) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment