Skip to content

Instantly share code, notes, and snippets.

View maxaleks's full-sized avatar
🏠
Working from home

Max Alekseenko maxaleks

🏠
Working from home
View GitHub Profile
0x008289692650899F2Ec208d9A6d5d4527dB36E8f
0x654605f067700cd389950F5db062c47727B6dC61

Keybase proof

I hereby claim:

  • I am maxaleks on github.
  • I am maxaleks (https://keybase.io/maxaleks) on keybase.
  • I have a public key ASA8SRQYIGTrJtUBGkbfy4rObuLbKSu65MRi-tx5a_ehxwo

To claim this, I am signing this object:

@maxaleks
maxaleks / ballot.sol
Created May 14, 2018 10:10
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.21;
contract Random {
function random() external view returns (uint256) {
return uint256(keccak256(keccak256(blockhash(block.number), 0), now));
}
}
contract Test {
Random random;
@maxaleks
maxaleks / ballot.sol
Created May 14, 2018 12:56
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.23+commit.124ca40d.js&optimize=false&gist=
pragma solidity ^0.4.21;
contract Random {
function random() external view returns (uint256) {
return uint256(blockhash(block.number));
}
}
contract Test {
Random random;
Game {
Gold gold;
Details details;
buyDetailForEther(type) payable {
uint256 price = details.getPrice(type);
gold.buyGoldRemote(msg.value, price);
address(gold).transfer(msg.value); // transfer ether to Gold contract
details.buyDetail(msg.sender, type);
gold.transfer(details, price); // transfer gold to Details contract
@maxaleks
maxaleks / Bets.sol
Last active October 14, 2018 11:18
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=false&gist=
pragma solidity 0.4.25;
contract Gold {
function remoteApprove(address /*_to*/, uint256 /*_amount*/) external pure {}
function transferFrom(address /*_from*/, address /*_to*/, uint256 /*_amount*/) external pure {}
function balanceOf(address /*_user*/) external pure returns (uint256) {}
}
contract MainBets {
// the number of block after which the battle may be started
const dotenv = require('dotenv');
const { toWei } = require('web3-utils');
const HDWalletProvider = require('truffle-hdwallet-provider');
const NonceTrackerSubprovider = require('web3-provider-engine/subproviders/nonce-tracker');
const Web3 = require('web3');
dotenv.config();
dotenv.config({ path: '.env.local' });
library SafeMath8 {
function mul(uint8 a, uint8 b) internal pure returns (uint8) {
if (a == 0) {
return 0;
}
uint8 c = a * b;
assert(c / a == b);
return c;
}
pragma solidity 0.4.25;
contract Getter {
function getDragonGenome(uint256) external view returns (uint8[30]);
function getDragonTypes(uint256) external view returns (uint8[11]);
function getDragonTactics(uint256) external view returns (uint8, uint8);
function getDragonBattles(uint256) external view returns (uint16, uint16);
function getDragonSkills(uint256) external view returns (uint32, uint32, uint32, uint32, uint32);
function getDragonParents(uint256) external view returns (uint256[2]);
function getDragonSpecialAttack(uint256) external view returns (uint8, uint32, uint8, uint8);