It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
function placeBet(uint256 bets, bytes32 values1,bytes32 values2) public payable
{
if (ContractState == false)
{
ErrorLog(msg.sender, "ContractDisabled");
if (msg.sender.send(msg.value) == false) throw;
return;
}
var gamblesLength = gambles.length;
if (gamblesLength > 0)
{
uint8 gamblesCountInCurrentBlock = 0;
for(var i = gamblesLength - 1;i > 0; i--)
{
if (gambles[i].blockNumber == block.number)
{
if (gambles[i].player == msg.sender)
{
ErrorLog(msg.sender, "Play twice the same block");
if (msg.sender.send(msg.value) == false) throw;
return;
}
gamblesCountInCurrentBlock++;
if (gamblesCountInCurrentBlock >= maxGamblesPerBlock)
{
ErrorLog(msg.sender, "maxGamblesPerBlock");
if (msg.sender.send(msg.value) == false) throw;
return;
}
}
else
{
break;
}
}
}
var _currentMaxBet = currentMaxBet;
if (msg.value < _currentMaxBet/256 || bets == 0)
{
ErrorLog(msg.sender, "Wrong bet value");
if (msg.sender.send(msg.value) == false) throw;
return;
}
if (msg.value > _currentMaxBet)
{
ErrorLog(msg.sender, "Limit for table");
if (msg.sender.send(msg.value) == false) throw;
return;
}
GameInfo memory g = GameInfo(msg.sender, block.number, 37, bets, values1,values2);
if (totalBetValue(g) != msg.value)
{
ErrorLog(msg.sender, "Wrong bet value");
if (msg.sender.send(msg.value) == false) throw;
return;
}
address affiliate = 0;
uint16 coef_affiliate = 0;
uint16 coef_player;
if (address(smartAffiliateContract) > 0)
{
(affiliate, coef_affiliate, coef_player) = smartAffiliateContract.getAffiliateInfo(msg.sender);
}
else
{
coef_player = CoefPlayerEmission;
}
uint256 playerTokens;
uint8 errorCodeEmission;
(playerTokens, errorCodeEmission) = smartToken.emission(msg.sender, affiliate, msg.value, coef_player, coef_affiliate);
if (errorCodeEmission != 0)
{
if (errorCodeEmission == 1)
ErrorLog(msg.sender, "token operations stopped");
else if (errorCodeEmission == 2)
ErrorLog(msg.sender, "contract is not in a games list");
else if (errorCodeEmission == 3)
ErrorLog(msg.sender, "incorect player address");
else if (errorCodeEmission == 4)
ErrorLog(msg.sender, "incorect value bet");
else if (errorCodeEmission == 5)
ErrorLog(msg.sender, "incorect Coefficient emissions");
if (msg.sender.send(msg.value) == false) throw;
return;
}
gambles.push(g);
PlayerBet(gamblesLength, playerTokens);
}
struct GameInfo
{
address player;
uint256 blockNumber;
uint8 wheelResult;
uint256 bets;
bytes32 values;
bytes32 values2;
}
// n - number player bet
// nBit - betIndex
function getBetValueByGamble(GameInfo memory gamble, uint8 n, uint8 nBit) private constant returns (uint256)
{
if (n <= 32) return getBetValue(gamble.values , n, nBit);
if (n <= 64) return getBetValue(gamble.values2, n - 32, nBit);
// there are 64 maximum unique bets (positions) in one game
throw;
}
// n form 1 <= to <= 32
function getBetValue(bytes32 values, uint8 n, uint8 nBit) private constant returns (uint256)
{
// bet in credits (1..256)
uint256 bet = uint256(values[32 - n]) + 1;
if (bet < uint256(minCreditsOnBet[nBit]+1)) throw; //default: bet < 0+1
if (bet > uint256(256-maxCreditsOnBet[nBit])) throw; //default: bet > 256-0
return currentMaxBet * bet / 256;
}
function ProcessGames(uint256[] gameIndexes, bool simulate)
{
if (!simulate)
{
if (lastBlockGamesProcessed == block.number) return;
lastBlockGamesProcessed = block.number;
}
uint8 delay = BlockDelay;
uint256 length = gameIndexes.length;
bool success = false;
for(uint256 i = 0;i < length;i++)
{
if (ProcessGame(gameIndexes[i], delay) == GameStatus.Success) success = true;
}
if (simulate && !success) throw;
}
function ProcessGame(uint256 index, uint256 delay) private returns (GameStatus)
{
GameInfo memory g = gambles[index];
if (block.number - g.blockNumber >= 256) return GameStatus.Stop;
if (g.wheelResult == 37 && block.number > g.blockNumber + delay)
{
gambles[index].wheelResult = getRandomNumber(g.player, g.blockNumber);
uint256 playerWinnings = getGameResult(gambles[index]);
if (playerWinnings > 0)
{
if (g.player.send(playerWinnings) == false) throw;
}
EndGame(g.player, gambles[index].wheelResult, index);
return GameStatus.Success;
}
return GameStatus.Skipped;
}
function getRandomNumber(address player, uint256 playerblock) private returns(uint8 wheelResult)
{
// block.blockhash - hash of the given block - only works for 256 most recent blocks excluding current
bytes32 blockHash = block.blockhash(playerblock+BlockDelay);
if (blockHash==0)
{
ErrorLog(msg.sender, "Cannot generate random number");
wheelResult = 200;
}
else
{
bytes32 shaPlayer = sha3(player, blockHash);
wheelResult = uint8(uint256(shaPlayer)%37);
}
}
function getGameResult(GameInfo memory game) private constant returns (uint256 totalWin)
{
totalWin = 0;
uint8 nPlayerBetNo = 0;
// we sent count bets at last byte
uint8 betsCount = uint8(bytes32(game.bets)[0]);
for(uint8 i=0; i{
if (isBitSet(game.bets, i))
{
var winMul = winMatrix.getCoeff(getIndex(i, game.wheelResult)); // get win coef
if (winMul > 0) winMul++; // + return player bet
totalWin += winMul * getBetValueByGamble(game, nPlayerBetNo+1,i);
nPlayerBetNo++;
if (betsCount == 1) break;
betsCount--;
}
}
}
// unique combination of bet and wheelResult, used for access to WinMatrix
function getIndex(uint16 bet, uint16 wheelResult) private constant returns (uint16)
{
return (bet+1)*256 + (wheelResult+1);
}