Skip to content

Instantly share code, notes, and snippets.

View ngrinkevich's full-sized avatar

Nik Grinkevich ngrinkevich

View GitHub Profile
contract CallbackContract {
uint256 internal _randomNumber;
/**
* @dev Example of a callback method.
*/
function callback(uint256 requestResponse)
public
{
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
});
}
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, 0, "", {from: this.state.yourAddress, gas: 150000});
let requestId = request.logs[0].args.requestID.toNumber();
this.setState({
loading: true,
requestId: requestId
});
}
/**
* @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(
@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'

Keybase proof

I hereby claim:

  • I am ngrinkevich on github.
  • I am nikgrinkevich (https://keybase.io/nikgrinkevich) on keybase.
  • I have a public key whose fingerprint is 2010 C31E 8467 2E7B CAAD A429 B33D B6D8 3F2A 0C9B

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1N7FJhVSPcrJ95goyecQmaxqtJsZG8gr2P https://explorer.blockstack.org/address/1N7FJhVSPcrJ95goyecQmaxqtJsZG8gr2P
import "AssetLedger.sol";
// TODO describe rules of exchange.
// In the AF market all users benefit from a "last look" facility to prevent
// them falling foul of mechanical arb sniping by those exploiting the way
// the blockchain and smart contract data lags the real markets being tracked.
// The system proceeds through a series of batching steps, which in practice
// might correspond to some number of blocks (for example, each batching step
// corresponds to a block). Orders collected in batching step B_i are initially
// in a "pending" state although visible within the book. Orders then remain
createNode((err, node) => {
if (err) {
return console.log('Could not create the Node', err)
}
node.on('peer:discovery', (peerInfo) => {
const idStr = peerInfo.id.toB58String()
console.log('Discovered a peer:', idStr)
})