Skip to content

Instantly share code, notes, and snippets.

View ngrinkevich's full-sized avatar

Nik Grinkevich ngrinkevich

View GitHub Profile
@ngrinkevich
ngrinkevich / kubectl-shortcuts.sh
Created January 25, 2018 10:24 — forked from tamas-molnar/kubectl-shortcuts.sh
aliases and shortcuts for kubectl
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'
/**
* @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(
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
});
}
randomBeacon.RelayEntryGenerated().watch((error, result) => {
if (result.args.requestID.toNumber() === this.state.requestId) {
let randomBigNumber = result.args.requestResponse;
// ...
}
});
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
});
}
contract CallbackContract {
uint256 internal _randomNumber;
/**
* @dev Example of a callback method.
*/
function callback(uint256 requestResponse)
public
{