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
alias kc='kubectl' | |
alias kclf='kubectl logs --tail=200 -f' | |
alias kcgs='kubectl get service -o wide' | |
alias kcgd='kubectl get deployment -o wide' | |
alias kcgp='kubectl get pod -o wide' | |
alias kcgn='kubectl get node -o wide' | |
alias kcdp='kubectl describe pod' | |
alias kcds='kubectl describe service' | |
alias kcdd='kubectl describe deployment' | |
alias kcdf='kubectl delete -f' |
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
/** | |
* @dev Creates a request to generate a new relay entry, which will include a | |
* random number (by signing the previous entry's random number). | |
* @param blockReward The value in KEEP for generating the signature. | |
* @param seed Initial seed random value from the client. It should be a cryptographically generated random value. | |
* @param callbackContract Callback contract address. | |
* @param callbackMethod Callback contract method signature. | |
* @return An uint256 representing uniquely generated ID. It is also returned as part of the event. | |
*/ | |
function requestRelayEntry( |
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
async requestRelayEntry() { | |
let request = await this.state.randomBeacon.requestRelayEntry(0, 0, 0, "", {from: this.state.yourAddress, gas: 150000}); | |
let requestId = request.logs[0].args.requestID.toNumber(); | |
this.setState({ | |
loading: true, | |
requestId: requestId | |
}); | |
} |
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
randomBeacon.RelayEntryGenerated().watch((error, result) => { | |
if (result.args.requestID.toNumber() === this.state.requestId) { | |
let randomBigNumber = result.args.requestResponse; | |
// ... | |
} | |
}); |
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
async requestRelayEntry() { | |
let request = await this.state.randomBeacon.requestRelayEntry( | |
0, 0, callbackContract.address, "callback(uint256)", {from: this.state.yourAddress, gas: 150000} | |
); | |
let requestId = request.logs[0].args.requestID.toNumber(); | |
this.setState({ | |
loading: true, | |
requestId: requestId | |
}); | |
} |
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
contract CallbackContract { | |
uint256 internal _randomNumber; | |
/** | |
* @dev Example of a callback method. | |
*/ | |
function callback(uint256 requestResponse) | |
public | |
{ |
OlderNewer