Unnamed: 0
int64 0
7.36k
| comments
stringlengths 3
35.2k
| code_string
stringlengths 1
527k
| code
stringlengths 1
527k
| __index_level_0__
int64 0
88.6k
|
---|---|---|---|---|
6 | // Constructor initiates String A and String B with the parameters./ | constructor(string memory _A, string memory _B) {
uint256 private solutionsId = 0;
uint256 totalVotes = 0;
A = _A;
B = _B;
}
| constructor(string memory _A, string memory _B) {
uint256 private solutionsId = 0;
uint256 totalVotes = 0;
A = _A;
B = _B;
}
| 33,981 |
6 | // If the hash is correct, finalize the state with provided transfers. / | transfers = LibOutcome.CoinTransfer[2]([
| transfers = LibOutcome.CoinTransfer[2]([
| 18,281 |
63 | // Sets token value in Wei./valueInWei New value. | function changeBaseTokenPrice(uint valueInWei)
external
onlyFounder
returns (bool)
| function changeBaseTokenPrice(uint valueInWei)
external
onlyFounder
returns (bool)
| 42,410 |
13 | // Gets a string value with its key. key Key of the value.return String value. / | function getString(bytes32 key) public view returns (string) {
return _string[key];
}
| function getString(bytes32 key) public view returns (string) {
return _string[key];
}
| 13,804 |
20 | // Allows to multiply the reward for burning based on the bet amount.BURNMULT is a /100 ratio | config["BURNMULT"] = 100;
config["MINBET"] = 0.01 ether;
config["MAXBET"] = 1 ether;
| config["BURNMULT"] = 100;
config["MINBET"] = 0.01 ether;
config["MAXBET"] = 1 ether;
| 42,672 |
114 | // OLA_ADDITIONS : Made internal and removes Admin check.Sets a new Comptroller for the marketAdmin function to set a new Comptroller return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)/ | function _setComptroller(ComptrollerInterface newComptroller) internal returns (uint) {
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke Comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market's Comptroller to newComptroller
comptroller = newComptroller;
// Emit NewComptroller(oldComptroller, newComptroller)
emit NewComptroller(oldComptroller, newComptroller);
return uint(Error.NO_ERROR);
}
| function _setComptroller(ComptrollerInterface newComptroller) internal returns (uint) {
ComptrollerInterface oldComptroller = comptroller;
// Ensure invoke Comptroller.isComptroller() returns true
require(newComptroller.isComptroller(), "marker method returned false");
// Set market's Comptroller to newComptroller
comptroller = newComptroller;
// Emit NewComptroller(oldComptroller, newComptroller)
emit NewComptroller(oldComptroller, newComptroller);
return uint(Error.NO_ERROR);
}
| 25,625 |
53 | // Calculates the token price (WEI / XCHNG) at the current timestamp/ during the auction; elapsed time = 0 before auction starts./ Based on the provided parameters, the price does not change in the first/ `price_constant^(1/price_exponent)` seconds due to rounding./ Rounding in `decay_rate` also produces values that increase instead of decrease/ in the beginning; these spikes decrease over time and are noticeable/ only in first hours. This should be calculated before usage./ return Returns the token price - Wei per XCHNG. | function calcTokenPrice() view private returns (uint) {
uint elapsed;
if (stage == Stages.AuctionStarted) {
// solium-disable-next-line security/no-block-members
elapsed = block.timestamp.sub(auction_start_time);
}
// uint decay_rate = elapsed ** price_exponent / price_constant;
// return price_start * (1 + elapsed) / (1 + elapsed + decay_rate);
uint decay_rate = (elapsed ** price_exponent).div(price_constant);
uint calcprice = price_start.mul(elapsed.add(1)).div(elapsed.add(1).add(decay_rate));
return calcprice;
}
| function calcTokenPrice() view private returns (uint) {
uint elapsed;
if (stage == Stages.AuctionStarted) {
// solium-disable-next-line security/no-block-members
elapsed = block.timestamp.sub(auction_start_time);
}
// uint decay_rate = elapsed ** price_exponent / price_constant;
// return price_start * (1 + elapsed) / (1 + elapsed + decay_rate);
uint decay_rate = (elapsed ** price_exponent).div(price_constant);
uint calcprice = price_start.mul(elapsed.add(1)).div(elapsed.add(1).add(decay_rate));
return calcprice;
}
| 38,565 |
83 | // State Mutations | function deposit() public {
uint _want = IERC20(want).balanceOf(address(this));
address _controller = For(fortube).controller();
if (_want > 0) {
WETH(address(weth)).withdraw(_want); //weth->eth
For(fortube).deposit.value(_want)(eth_address,_want);
}
}
| function deposit() public {
uint _want = IERC20(want).balanceOf(address(this));
address _controller = For(fortube).controller();
if (_want > 0) {
WETH(address(weth)).withdraw(_want); //weth->eth
For(fortube).deposit.value(_want)(eth_address,_want);
}
}
| 29,936 |
27 | // Add rewards from each collection | for (uint256 j = 0; j < ownerTokenIds[collections[i]][_addr].length; j++) {
_rewards = _rewards.add(calculateRewardsByTokenId(i, ownerTokenIds[collections[i]][_addr][j]));
}
| for (uint256 j = 0; j < ownerTokenIds[collections[i]][_addr].length; j++) {
_rewards = _rewards.add(calculateRewardsByTokenId(i, ownerTokenIds[collections[i]][_addr][j]));
}
| 28,861 |
229 | // Add liquidity to uniswap for specified token pair, utilizing the maximum balance possible | function _add_max_liquidity_uniswap(address token0, address token1) internal virtual {
uint256 _token0Balance = IERC20Upgradeable(token0).balanceOf(address(this));
uint256 _token1Balance = IERC20Upgradeable(token1).balanceOf(address(this));
_safeApproveHelper(token0, uniswap, _token0Balance);
_safeApproveHelper(token1, uniswap, _token1Balance);
IUniswapRouterV2(uniswap).addLiquidity(token0, token1, _token0Balance, _token1Balance, 0, 0, address(this), block.timestamp);
}
| function _add_max_liquidity_uniswap(address token0, address token1) internal virtual {
uint256 _token0Balance = IERC20Upgradeable(token0).balanceOf(address(this));
uint256 _token1Balance = IERC20Upgradeable(token1).balanceOf(address(this));
_safeApproveHelper(token0, uniswap, _token0Balance);
_safeApproveHelper(token1, uniswap, _token1Balance);
IUniswapRouterV2(uniswap).addLiquidity(token0, token1, _token0Balance, _token1Balance, 0, 0, address(this), block.timestamp);
}
| 8,854 |
21 | // Minimum buy $15 | require(etherValue >= 25000000000000000, "Minimum BET-B purchase limit is 0.025 ETH");
require(buyer != address(0), "Can't send to Zero address");
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
uint256 referralTokenBal = tokenLedger[_referredBy];
| require(etherValue >= 25000000000000000, "Minimum BET-B purchase limit is 0.025 ETH");
require(buyer != address(0), "Can't send to Zero address");
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
uint256 referralTokenBal = tokenLedger[_referredBy];
| 1,676 |
142 | // Sets Hold time_holdDays - Hold time in days/ | function setHoldTime (
uint256 _holdDays
)
public
onlyOwner
| function setHoldTime (
uint256 _holdDays
)
public
onlyOwner
| 18,647 |
49 | // Users withdraw their desposits/ | function withdraw() public payable{
_withdraw();
}
| function withdraw() public payable{
_withdraw();
}
| 25,499 |
19 | // uniswapFeePercent == 0.3% | position.uniswapFeePercent = uniswapFeePercent;
if (srcHandlerID != dstHandlerID) {
position.uniswapFee = flashloanAmount
.unifiedMul(position.uniswapFeePercent + 0.003 ether);
| position.uniswapFeePercent = uniswapFeePercent;
if (srcHandlerID != dstHandlerID) {
position.uniswapFee = flashloanAmount
.unifiedMul(position.uniswapFeePercent + 0.003 ether);
| 9,835 |
117 | // It allows the admin to recover wrong tokens sent to the contract _tokenAddress: the address of the token to withdraw _tokenAmount: the number of tokens to withdraw This function is only callable by admin. / | function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(stakedToken), "Cannot be staked token");
require(_tokenAddress != address(rewardToken), "Cannot be reward token");
IBEP20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);
emit AdminTokenRecovery(_tokenAddress, _tokenAmount);
}
| function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner {
require(_tokenAddress != address(stakedToken), "Cannot be staked token");
require(_tokenAddress != address(rewardToken), "Cannot be reward token");
IBEP20(_tokenAddress).safeTransfer(address(msg.sender), _tokenAmount);
emit AdminTokenRecovery(_tokenAddress, _tokenAmount);
}
| 16,387 |
14 | // Handle Users/ | UserStat memory user = userMap[msg.sender];
uint256 _theShapeId = _shapeId;
if(!user.isUsed){ // New User Come
| UserStat memory user = userMap[msg.sender];
uint256 _theShapeId = _shapeId;
if(!user.isUsed){ // New User Come
| 54,074 |
475 | // Rebuild the resolver caches in all MixinResolver contracts - batch 2; | addressresolver_rebuildCaches_2();
| addressresolver_rebuildCaches_2();
| 6,200 |
123 | // Computes the amount when redeeming pool token to one specific underlying token. _amount Amount of pool token to redeem. _i Index of the underlying token to redeem to.return Amount of underlying token that can be redeem to. / | function getRedeemSingleAmount(uint256 _amount, uint256 _i) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amount > 0, "zero amount");
require(_i < _balances.length, "invalid token");
uint256 A = getA();
uint256 D = totalSupply;
uint256 feeAmount = 0;
if (redeemFee > 0) {
feeAmount = _amount.mul(redeemFee).div(feeDenominator);
// Redemption fee is charged with pool token before redemption.
_amount = _amount.sub(feeAmount);
}
// The pool token amount becomes D - _amount
uint256 y = _getY(_balances, _i, D.sub(_amount), A);
uint256 dy = _balances[_i].sub(y).div(precisions[_i]);
return (dy, feeAmount);
}
| function getRedeemSingleAmount(uint256 _amount, uint256 _i) external view returns (uint256, uint256) {
uint256[] memory _balances = balances;
require(_amount > 0, "zero amount");
require(_i < _balances.length, "invalid token");
uint256 A = getA();
uint256 D = totalSupply;
uint256 feeAmount = 0;
if (redeemFee > 0) {
feeAmount = _amount.mul(redeemFee).div(feeDenominator);
// Redemption fee is charged with pool token before redemption.
_amount = _amount.sub(feeAmount);
}
// The pool token amount becomes D - _amount
uint256 y = _getY(_balances, _i, D.sub(_amount), A);
uint256 dy = _balances[_i].sub(y).div(precisions[_i]);
return (dy, feeAmount);
}
| 55,358 |
9 | // Calculate orderIds. | bytes16 oldOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, oldChainIdAdapterIdAssetIdPrice, oldForeignAddress)));
bytes16 newOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, newChainIdAdapterIdAssetIdPrice, newForeignAddress)));
| bytes16 oldOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, oldChainIdAdapterIdAssetIdPrice, oldForeignAddress)));
bytes16 newOrderId = bytes16(keccak256(abi.encodePacked(msg.sender, newChainIdAdapterIdAssetIdPrice, newForeignAddress)));
| 38,118 |
25 | // rTotal should increase as well | _rTotal = _rTotal.add(AIRDROP_AMOUNT.mul(_currentRate));
_isRegisterAirdropDistribution = true;
| _rTotal = _rTotal.add(AIRDROP_AMOUNT.mul(_currentRate));
_isRegisterAirdropDistribution = true;
| 36,332 |
10 | // Verifies various hashed data structures / | contract Verification {
/**
* @notice Verify a flat array of data elements
*
* @param _data the array of data elements to be verified
* @param _commitment the commitment hash to check
* @return a boolean value representing the success or failure of the operation
*/
function verifyMessageArray(bytes32[] calldata _data, bytes32 _commitment) public pure returns (bool) {
bytes32 commitment = _data[0];
for (uint256 i = 1; i < _data.length; i++) {
commitment = keccak256(abi.encodePacked(commitment, _data[i]));
}
return commitment == _commitment;
}
/**
* @notice Verify all elements in a Merkle Tree data structure
* @dev Performs an in-place merkle tree root calculation
* @dev Note there is currently an assumption here that if the number
* of leaves is odd, the final leaf will be duplicated prior to
* calling this function
*
* @param _data the array of data elements to be verified
* @param _commitment the expected merkle root of the structure
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleAll(bytes32[] memory _data, bytes32 _commitment) public pure returns (bool) {
uint256 hashLength = _data.length;
for (uint256 j = 0; hashLength > 1; j = 0) {
for (uint256 i = 0; i < hashLength; i = i + 2) {
_data[j] = keccak256(abi.encodePacked(_data[i], _data[i + 1]));
j = j + 1;
}
// This effectively halves the list length every time,
// but a subtraction op-code costs less
hashLength = hashLength - j;
}
return _data[0] == _commitment;
}
/**
* @notice Verify a single leaf element in a Merkle Tree
* @dev For sake of simplifying the verification algorithm,
* we make an assumption that the proof elements are sorted
*
* @param root the root of the merkle tree
* @param leaf the leaf which needs to be proved
* @param proof the array of proofs to help verify the leafs membership
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleLeaf(
bytes32 root,
bytes32 leaf,
bytes32[] calldata proof
) public pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash < proofElement) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash == root;
}
/**
* @notice Verify that a specific leaf element is part of the Merkle Tree at a specific position in the tree
* @dev For sake of simplifying the verification algorithm,
* we make an assumption that the proof elements are sorted
*
* @param root the root of the merkle tree
* @param leaf the leaf which needs to be proved
* @param pos the position of the leaf, index starting with 0
* @param width the width or number of leaves in the tree
* @param proof the array of proofs to help verify the leafs membership, ordered from leaf to root
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleLeafAtPosition(
bytes32 root,
bytes32 leaf,
uint256 pos,
uint256 width,
bytes32[] calldata proof
) public view returns (bool) {
console.log("root");
console.logBytes32(root);
console.log("leaf");
console.logBytes32(leaf);
console.log("pos", pos);
console.log("width", width);
bytes32 computedHash = leaf;
if (pos + 1 > width) {
return false;
}
uint256 i = 0;
for (uint256 height = 0; width > 1; height++) {
console.log("height", height);
console.log(" pos", pos);
console.log(" width", width);
bool computedHashLeft = pos % 2 == 0;
console.log(" computedHashLeft", computedHashLeft);
// check if at rightmost branch and whether the computedHash is left
if (pos + 1 == width && computedHashLeft) {
// there is no sibling and also no element in proofs, so we just go up one layer in the tree
pos /= 2;
width = ((width - 1) / 2) + 1;
continue;
}
if (i >= proof.length) {
// need another element from the proof we don't have
return false;
}
bytes32 proofElement = proof[i];
console.log(" proofElement");
console.logBytes32(proofElement);
if (computedHashLeft) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
console.log(" computedHash");
console.logBytes32(computedHash);
pos /= 2;
width = ((width - 1) / 2) + 1;
i++;
}
return computedHash == root;
}
}
| contract Verification {
/**
* @notice Verify a flat array of data elements
*
* @param _data the array of data elements to be verified
* @param _commitment the commitment hash to check
* @return a boolean value representing the success or failure of the operation
*/
function verifyMessageArray(bytes32[] calldata _data, bytes32 _commitment) public pure returns (bool) {
bytes32 commitment = _data[0];
for (uint256 i = 1; i < _data.length; i++) {
commitment = keccak256(abi.encodePacked(commitment, _data[i]));
}
return commitment == _commitment;
}
/**
* @notice Verify all elements in a Merkle Tree data structure
* @dev Performs an in-place merkle tree root calculation
* @dev Note there is currently an assumption here that if the number
* of leaves is odd, the final leaf will be duplicated prior to
* calling this function
*
* @param _data the array of data elements to be verified
* @param _commitment the expected merkle root of the structure
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleAll(bytes32[] memory _data, bytes32 _commitment) public pure returns (bool) {
uint256 hashLength = _data.length;
for (uint256 j = 0; hashLength > 1; j = 0) {
for (uint256 i = 0; i < hashLength; i = i + 2) {
_data[j] = keccak256(abi.encodePacked(_data[i], _data[i + 1]));
j = j + 1;
}
// This effectively halves the list length every time,
// but a subtraction op-code costs less
hashLength = hashLength - j;
}
return _data[0] == _commitment;
}
/**
* @notice Verify a single leaf element in a Merkle Tree
* @dev For sake of simplifying the verification algorithm,
* we make an assumption that the proof elements are sorted
*
* @param root the root of the merkle tree
* @param leaf the leaf which needs to be proved
* @param proof the array of proofs to help verify the leafs membership
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleLeaf(
bytes32 root,
bytes32 leaf,
bytes32[] calldata proof
) public pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash < proofElement) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash == root;
}
/**
* @notice Verify that a specific leaf element is part of the Merkle Tree at a specific position in the tree
* @dev For sake of simplifying the verification algorithm,
* we make an assumption that the proof elements are sorted
*
* @param root the root of the merkle tree
* @param leaf the leaf which needs to be proved
* @param pos the position of the leaf, index starting with 0
* @param width the width or number of leaves in the tree
* @param proof the array of proofs to help verify the leafs membership, ordered from leaf to root
* @return a boolean value representing the success or failure of the operation
*/
function verifyMerkleLeafAtPosition(
bytes32 root,
bytes32 leaf,
uint256 pos,
uint256 width,
bytes32[] calldata proof
) public view returns (bool) {
console.log("root");
console.logBytes32(root);
console.log("leaf");
console.logBytes32(leaf);
console.log("pos", pos);
console.log("width", width);
bytes32 computedHash = leaf;
if (pos + 1 > width) {
return false;
}
uint256 i = 0;
for (uint256 height = 0; width > 1; height++) {
console.log("height", height);
console.log(" pos", pos);
console.log(" width", width);
bool computedHashLeft = pos % 2 == 0;
console.log(" computedHashLeft", computedHashLeft);
// check if at rightmost branch and whether the computedHash is left
if (pos + 1 == width && computedHashLeft) {
// there is no sibling and also no element in proofs, so we just go up one layer in the tree
pos /= 2;
width = ((width - 1) / 2) + 1;
continue;
}
if (i >= proof.length) {
// need another element from the proof we don't have
return false;
}
bytes32 proofElement = proof[i];
console.log(" proofElement");
console.logBytes32(proofElement);
if (computedHashLeft) {
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
console.log(" computedHash");
console.logBytes32(computedHash);
pos /= 2;
width = ((width - 1) / 2) + 1;
i++;
}
return computedHash == root;
}
}
| 9,161 |
12 | // will show assets of the function caller | function viewAssets()public view returns(uint[] memory){
return (profile[msg.sender].assetList);
}
| function viewAssets()public view returns(uint[] memory){
return (profile[msg.sender].assetList);
}
| 16,417 |
9 | // feeTo address, ERC1155 Contract, ERC20 Payment Token List 설정/ | constructor(NFTBaseLike nftBase_,ERC20TokenListLike erc20s_) {
_feeTo = address(this);
_nftBase = NFTBaseLike(nftBase_);
_erc20s = ERC20TokenListLike(erc20s_);
}
| constructor(NFTBaseLike nftBase_,ERC20TokenListLike erc20s_) {
_feeTo = address(this);
_nftBase = NFTBaseLike(nftBase_);
_erc20s = ERC20TokenListLike(erc20s_);
}
| 24,213 |
2 | // Decode a CBOR value into a Witnet.Result instance./_cborValue An instance of `Witnet.Value`./ return A `Witnet.Result` instance. | function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| function resultFromCborValue(Witnet.CBOR memory _cborValue)
public pure
returns (Witnet.Result memory)
| 31,457 |
20 | // Allows investor to withdraw overpay / | function withdrawOverpay() {
uint amount = overpays[msg.sender];
overpays[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
OverpayRefund(msg.sender, amount);
} else {
overpays[msg.sender] = amount; //restore funds in case of failed send
}
}
}
| function withdrawOverpay() {
uint amount = overpays[msg.sender];
overpays[msg.sender] = 0;
if (amount > 0) {
if (msg.sender.send(amount)) {
OverpayRefund(msg.sender, amount);
} else {
overpays[msg.sender] = amount; //restore funds in case of failed send
}
}
}
| 51,624 |
97 | // Internal function to set the token URI for a given tokenReverts if the token ID does not exist tokenId uint256 ID of the token to set its URI uri string URI to assign / | function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId));
_tokenURIs = uri;
}
| function _setTokenURI(uint256 tokenId, string memory uri) internal {
require(_exists(tokenId));
_tokenURIs = uri;
}
| 29,702 |
26 | // ---------------------------------------------------------------------------- @Name KLEToken @Desc Token name : 2018 지방선거 참여자 Token Symbol : KLEV18(Korea Locate Election Voter 2018) Token Name : 2018 지방선거 홍보왕 Token Symbol : KLEH18(Korea Locate Election Honorary 2018) Token Name : 2018 지방선거 후원자 Token Symbol : KLES18(Korea Locate Election Sponsor 2018) ---------------------------------------------------------------------------- | contract KLEToken is TokenBase {
string public name;
uint8 public decimals;
string public symbol;
constructor (uint a_totalSupply, string a_tokenName, string a_tokenSymbol, uint8 a_decimals) public {
m_aOwner = msg.sender;
_totalSupply = a_totalSupply;
_balances[msg.sender] = a_totalSupply;
name = a_tokenName;
symbol = a_tokenSymbol;
decimals = a_decimals;
}
// Allocate tokens to the users
function AllocateToken(address[] a_receiver)
external
IsOwner
AllLock {
uint receiverLength = a_receiver.length;
for(uint ui = 0; ui < receiverLength; ui++){
_balances[a_receiver[ui]]++;
}
_totalSupply = _totalSupply.add(receiverLength);
}
function EndEvent()
external
IsOwner {
m_bIsLock = true;
}
} | contract KLEToken is TokenBase {
string public name;
uint8 public decimals;
string public symbol;
constructor (uint a_totalSupply, string a_tokenName, string a_tokenSymbol, uint8 a_decimals) public {
m_aOwner = msg.sender;
_totalSupply = a_totalSupply;
_balances[msg.sender] = a_totalSupply;
name = a_tokenName;
symbol = a_tokenSymbol;
decimals = a_decimals;
}
// Allocate tokens to the users
function AllocateToken(address[] a_receiver)
external
IsOwner
AllLock {
uint receiverLength = a_receiver.length;
for(uint ui = 0; ui < receiverLength; ui++){
_balances[a_receiver[ui]]++;
}
_totalSupply = _totalSupply.add(receiverLength);
}
function EndEvent()
external
IsOwner {
m_bIsLock = true;
}
} | 40,418 |
244 | // Can only borrow up to what the contract has in reserve NOTE: Running near 100% is discouraged | available = Math.min(available, IERC20(token).balanceOf(address(this)));
| available = Math.min(available, IERC20(token).balanceOf(address(this)));
| 59,637 |
249 | // check if ether payment is enough | uint256 _singleCrabPrice = getCurrentCrabPrice();
uint256 _totalCrabPrice = _singleCrabPrice * _crabAmount;
uint256 _totalCryptantPrice = getCurrentCryptantFragmentPrice() * _cryptantFragmentAmount;
uint256 _cryptantFragmentsGained = _cryptantFragmentAmount;
| uint256 _singleCrabPrice = getCurrentCrabPrice();
uint256 _totalCrabPrice = _singleCrabPrice * _crabAmount;
uint256 _totalCryptantPrice = getCurrentCryptantFragmentPrice() * _cryptantFragmentAmount;
uint256 _cryptantFragmentsGained = _cryptantFragmentAmount;
| 36,954 |
96 | // get the amount of staking bonuses available in the pool.-----------------------------------------------------------returns the amount of staking bounses available for ETH and Token. / | function getAvailableBonus() external view returns(uint available_ETH, uint available_token) {
available_ETH = (address(this).balance).sub(_pendingBonusesWeth);
available_token = (token.balanceOf(address(this))).sub(_pendingBonusesToken);
return (available_ETH, available_token);
}
| function getAvailableBonus() external view returns(uint available_ETH, uint available_token) {
available_ETH = (address(this).balance).sub(_pendingBonusesWeth);
available_token = (token.balanceOf(address(this))).sub(_pendingBonusesToken);
return (available_ETH, available_token);
}
| 37,189 |
124 | // WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible Requirements: - `tokenId` must not exist. - `to` cannot be the zero address. Emits a {Transfer} event./ | function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
| 34,332 |
75 | // Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).If there are multiple variables, please pack them into a uint64. / | function _setAux(address owner, uint64 aux) internal {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly {
// Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
| function _setAux(address owner, uint64 aux) internal {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
assembly {
// Cast aux without masking.
auxCasted := aux
}
packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
_packedAddressData[owner] = packed;
}
| 27,094 |
579 | // Compute hash of data | let dataHash := keccak256(add(data, 32), mload(data))
| let dataHash := keccak256(add(data, 32), mload(data))
| 2,529 |
0 | // Code Start Here | function SetUsdt(uint256 usdt_) public {
usdt = usdt_;
}
| function SetUsdt(uint256 usdt_) public {
usdt = usdt_;
}
| 9,281 |
6 | // 判定是否為owner集合 | modifier onlyOwner(){
require(isOwner[msg.sender], "not owner.");
_;
}
| modifier onlyOwner(){
require(isOwner[msg.sender], "not owner.");
_;
}
| 7,001 |
29 | // Deletes the data associated with a claim (after claim has reached its final state) _claimIdentifier is the internal claim ID | function _cleanUpClaim(bytes32 _claimIdentifier) internal {
// Protocol no longer has an active claim associated with it
delete protocolClaimActive[claims_[_claimIdentifier].protocol];
// Claim object is deleted
delete claims_[_claimIdentifier];
uint256 publicID = internalToPublicID[_claimIdentifier];
// Deletes the public and internal ID key mappings
delete publicToInternalID[publicID];
delete internalToPublicID[_claimIdentifier];
}
| function _cleanUpClaim(bytes32 _claimIdentifier) internal {
// Protocol no longer has an active claim associated with it
delete protocolClaimActive[claims_[_claimIdentifier].protocol];
// Claim object is deleted
delete claims_[_claimIdentifier];
uint256 publicID = internalToPublicID[_claimIdentifier];
// Deletes the public and internal ID key mappings
delete publicToInternalID[publicID];
delete internalToPublicID[_claimIdentifier];
}
| 84,890 |
4 | // addFounders add founders to the organization.this function can be called only after forgeOrg and before setSchemes_avatar the organization avatar_founders An array with the addresses of the founders of the organization_foundersTokenAmount An array of amount of tokens that the foundersreceive in the new organization_foundersReputationAmount An array of amount of reputation that the founders receive in the new organization return bool true or false/ | function addFounders (
Avatar _avatar,
address[] calldata _founders,
uint[] calldata _foundersTokenAmount,
uint[] calldata _foundersReputationAmount
)
external
returns(bool)
| function addFounders (
Avatar _avatar,
address[] calldata _founders,
uint[] calldata _foundersTokenAmount,
uint[] calldata _foundersReputationAmount
)
external
returns(bool)
| 23,355 |
108 | // TheGame contract implement ERC667 Recipientand can receive token/ether only from Ponzi Token/ | contract TheGame is ERC677Recipient {
using SafeMath for uint256;
enum State {
NotActive, //NotActive
Active //Active
}
State private m_state;
address private m_owner;
uint256 private m_level;
PlayersStorage private m_playersStorage;
PonziTokenMinInterface private m_ponziToken;
uint256 private m_interestRateNumerator;
uint256 private constant INTEREST_RATE_DENOMINATOR = 1000;
uint256 private m_creationTimestamp;
uint256 private constant DURATION_TO_ACCESS_FOR_OWNER = 144 days;
uint256 private constant COMPOUNDING_FREQ = 1 days;
uint256 private constant DELAY_ON_EXIT = 100 hours;
uint256 private constant DELAY_ON_NEW_LEVEL = 7 days;
string private constant NOT_ACTIVE_STR = "NotActive";
uint256 private constant PERCENT_TAX_ON_EXIT = 10;
string private constant ACTIVE_STR = "Active";
uint256 private constant PERCENT_REFERRAL_BOUNTY = 1;
uint256 private m_levelStartupTimestamp;
uint256 private m_ponziPriceInWei;
address private m_priceSetter;
////////////////
// EVENTS
//
event NewPlayer(address indexed addr, uint256 input, uint256 when);
event DeletePlayer(address indexed addr, uint256 when);
event NewLevel(uint256 when, uint256 newLevel);
event StateChanged(address indexed who, State newState);
event PonziPriceChanged(address indexed who, uint256 newPrice);
////////////////
// MODIFIERS - Restricting Access and State Machine patterns
//
modifier onlyOwner() {
require(msg.sender == m_owner);
_;
}
modifier onlyPonziToken() {
require(msg.sender == address(m_ponziToken));
_;
}
modifier atState(State state) {
require(m_state == state);
_;
}
modifier checkAccess() {
require(m_state == State.NotActive // solium-disable-line indentation, operator-whitespace
|| now.sub(m_creationTimestamp) <= DURATION_TO_ACCESS_FOR_OWNER);
_;
}
modifier isPlayer(address addr) {
require(m_playersStorage.playerExist(addr));
_;
}
modifier gameIsAvailable() {
require(now >= m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL));
_;
}
///////////////
// CONSTRUCTOR
//
/**
* @dev Constructor PonziToken.
*/
function TheGame(address ponziTokenAddr) public {
require(ponziTokenAddr != address(0));
m_ponziToken = PonziTokenMinInterface(ponziTokenAddr);
m_owner = msg.sender;
m_creationTimestamp = now;
m_state = State.NotActive;
m_level = 1;
m_interestRateNumerator = calcInterestRateNumerator(m_level);
}
/**
* @dev Fallback func can recive eth only from Ponzi token
*/
function() public payable onlyPonziToken() { }
/**
* Contract calc output of sender and transfer token/eth it to him.
* If token/ethnot enough on balance, then transfer all and gp to next level.
*
* @dev Sender exit from the game. Sender must be player.
*/
function exit()
external
atState(State.Active)
gameIsAvailable()
isPlayer(msg.sender)
{
uint256 input;
uint256 timestamp;
timestamp = m_playersStorage.playerTimestamp(msg.sender);
input = m_playersStorage.playerInput(msg.sender);
// Check whether the player is DELAY_ON_EXIT hours in the game
require(now >= timestamp.add(DELAY_ON_EXIT));
// calc output
uint256 outputInPonzi = calcOutput(input, now.sub(timestamp).div(COMPOUNDING_FREQ));
assert(outputInPonzi > 0);
// convert ponzi to eth
uint256 outputInWei = ponziToWei(outputInPonzi, m_ponziPriceInWei);
// set zero before sending to prevent Re-Entrancy
m_playersStorage.deletePlayer(msg.sender);
if (m_ponziPriceInWei > 0 && address(this).balance >= outputInWei) {
// if we have enough eth on address(this).balance
// send it to sender
// WARNING
// untrusted Transfer !!!
uint256 oldBalance = address(this).balance;
msg.sender.transfer(outputInWei);
assert(address(this).balance.add(outputInWei) >= oldBalance);
} else if (m_ponziToken.balanceOf(address(this)) >= outputInPonzi) {
// else if we have enough ponzi on balance
// send it to sender
uint256 oldPonziBalance = m_ponziToken.balanceOf(address(this));
assert(m_ponziToken.transfer(msg.sender, outputInPonzi));
assert(m_ponziToken.balanceOf(address(this)).add(outputInPonzi) == oldPonziBalance);
} else {
// if we dont have nor eth, nor ponzi then transfer all avaliable ponzi to
// msg.sender and go to next Level
assert(m_ponziToken.transfer(msg.sender, m_ponziToken.balanceOf(address(this))));
assert(m_ponziToken.balanceOf(address(this)) == 0);
nextLevel();
}
}
/**
* @dev Get info about specified player.
* @param addr Adrress of specified player.
* @return input Input of specified player.
* @return timestamp Timestamp of specified player.
* @return inGame Whether specified player in game or not.
*/
function playerInfo(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 input, uint256 timestamp, bool inGame)
{
(input, timestamp, inGame) = m_playersStorage.playerInfo(addr);
}
/**
* @dev Get possible output for specified player at now.
* @param addr Adrress of specified player.
* @return input Possible output for specified player at now.
*/
function playerOutputAtNow(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 amount)
{
if (!m_playersStorage.playerExist(addr)) {
return 0;
}
uint256 input = m_playersStorage.playerInput(addr);
uint256 timestamp = m_playersStorage.playerTimestamp(addr);
uint256 numberOfPayout = now.sub(timestamp).div(COMPOUNDING_FREQ);
amount = calcOutput(input, numberOfPayout);
}
/**
* @dev Get delay on opportunity to exit for specified player at now.
* @param addr Adrress of specified player.
* @return input Delay for specified player at now.
*/
function playerDelayOnExit(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 delay)
{
if (!m_playersStorage.playerExist(addr)) {
return 0;
}
uint256 timestamp = m_playersStorage.playerTimestamp(msg.sender);
if (now >= timestamp.add(DELAY_ON_EXIT)) {
delay = 0;
} else {
delay = timestamp.add(DELAY_ON_EXIT).sub(now);
}
}
/**
* Sender try enter to the game.
*
* @dev Sender enter to the game. Sender must not be player.
* @param input Input of new player.
* @param referralAddress The referral address.
*/
function enter(uint256 input, address referralAddress)
external
atState(State.Active)
gameIsAvailable()
{
require(m_ponziToken.transferFrom(msg.sender, address(this), input));
require(newPlayer(msg.sender, input, referralAddress));
}
/**
* @dev Address of the price setter.
* @return Address of the price setter.
*/
function priceSetter() external view returns(address) {
return m_priceSetter;
}
/**
* @dev Price of one Ponzi token in wei.
* @return Price of one Ponzi token in wei.
*/
function ponziPriceInWei()
external
view
atState(State.Active)
returns(uint256)
{
return m_ponziPriceInWei;
}
/**
* @dev Сompounding freq of the game. Olways 1 day.
* @return Compounding freq of the game.
*/
function compoundingFreq()
external
view
atState(State.Active)
returns(uint256)
{
return COMPOUNDING_FREQ;
}
/**
* @dev Interest rate of the game as numerator/denominator.From 5% to 0.1%.
* @return numerator Interest rate numerator of the game.
* @return denominator Interest rate denominator of the game.
*/
function interestRate()
external
view
atState(State.Active)
returns(uint256 numerator, uint256 denominator)
{
numerator = m_interestRateNumerator;
denominator = INTEREST_RATE_DENOMINATOR;
}
/**
* @dev Level of the game.
* @return Level of the game.
*/
function level()
external
view
atState(State.Active)
returns(uint256)
{
return m_level;
}
/**
* @dev Get contract work state.
* @return Contract work state via string.
*/
function state() external view returns(string) {
if (m_state == State.NotActive)
return NOT_ACTIVE_STR;
else
return ACTIVE_STR;
}
/**
* @dev Get timestamp of the level startup.
* @return Timestamp of the level startup.
*/
function levelStartupTimestamp()
external
view
atState(State.Active)
returns(uint256)
{
return m_levelStartupTimestamp;
}
/**
* @dev Get amount of Ponzi tokens in the game.Ponzi tokens balanceOf the game.
* @return Contract work state via string.
*/
function totalPonziInGame()
external
view
returns(uint256)
{
return m_ponziToken.balanceOf(address(this));
}
/**
* @dev Get current delay on new level.
* @return Current delay on new level.
*/
function currentDelayOnNewLevel()
external
view
atState(State.Active)
returns(uint256 delay)
{
if (now >= m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL)) {
delay = 0;
} else {
delay = m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL).sub(now);
}
}
///////////////////
// ERC677 ERC677Recipient Methods
//
/**
* see: https://github.com/ethereum/EIPs/issues/677
*
* @dev ERC677 token fallback. Called when received Ponzi token
* and sender try enter to the game.
*
* @param from Received tokens from the address.
* @param amount Amount of recived tokens.
* @param data Received extra data.
* @return Whether successful entrance or not.
*/
function tokenFallback(address from, uint256 amount, bytes data)
public
atState(State.Active)
gameIsAvailable()
onlyPonziToken()
returns (bool)
{
address referralAddress = bytesToAddress(data);
require(newPlayer(from, amount, referralAddress));
return true;
}
/**
* @dev Set price of one Ponzi token in wei.
* @param newPrice Price of one Ponzi token in wei.
*/
function setPonziPriceinWei(uint256 newPrice)
public
atState(State.Active)
{
require(msg.sender == m_owner || msg.sender == m_priceSetter);
m_ponziPriceInWei = newPrice;
PonziPriceChanged(msg.sender, m_ponziPriceInWei);
}
/**
* @dev Owner do disown.
*/
function disown() public onlyOwner() atState(State.Active) {
delete m_owner;
}
/**
* @dev Set state of contract working.
* @param newState String representation of new state.
*/
function setState(string newState) public onlyOwner() checkAccess() {
if (keccak256(newState) == keccak256(NOT_ACTIVE_STR)) {
m_state = State.NotActive;
} else if (keccak256(newState) == keccak256(ACTIVE_STR)) {
if (address(m_playersStorage) == address(0))
m_playersStorage = (new PlayersStorage());
m_state = State.Active;
} else {
// if newState not valid string
revert();
}
StateChanged(msg.sender, m_state);
}
/**
* @dev Set the PriceSetter address, which has access to set one Ponzi
* token price in wei.
* @param newPriceSetter The address of new PriceSetter.
*/
function setPriceSetter(address newPriceSetter)
public
onlyOwner()
checkAccess()
atState(State.Active)
{
m_priceSetter = newPriceSetter;
}
/**
* @dev Try create new player.
* @param addr Adrress of pretender player.
* @param inputAmount Input tokens amount of pretender player.
* @param referralAddr Referral address of pretender player.
* @return Whether specified player in game or not.
*/
function newPlayer(address addr, uint256 inputAmount, address referralAddr)
private
returns(bool)
{
uint256 input = inputAmount;
// return false if player already in game or if input < 1000,
// because calcOutput() use INTEREST_RATE_DENOMINATOR = 1000.
// and input must div by INTEREST_RATE_DENOMINATOR, if
// input <1000 then dividing always equal 0.
if (m_playersStorage.playerExist(addr) || input < 1000)
return false;
// check if referralAddr is player
if (m_playersStorage.playerExist(referralAddr)) {
// transfer 1% input form addr to referralAddr :
// newPlayerInput = input * (100-PERCENT_REFERRAL_BOUNTY) %;
// referralInput = (current referral input) + input * PERCENT_REFERRAL_BOUNTY %
uint256 newPlayerInput = inputAmount.mul(uint256(100).sub(PERCENT_REFERRAL_BOUNTY)).div(100);
uint256 referralInput = m_playersStorage.playerInput(referralAddr);
referralInput = referralInput.add(inputAmount.sub(newPlayerInput));
// try set input of referralAddr player
assert(m_playersStorage.playerSetInput(referralAddr, referralInput));
// if success, set input of new player = newPlayerInput
input = newPlayerInput;
}
// try create new player
assert(m_playersStorage.newPlayer(addr, input, now));
NewPlayer(addr, input, now);
return true;
}
/**
* @dev Calc possibly output (compounding interest) for specified input and number of payout.
* @param input Input amount.
* @param numberOfPayout Number of payout.
* @return Possibly output.
*/
function calcOutput(uint256 input, uint256 numberOfPayout)
private
view
returns(uint256 output)
{
output = input;
uint256 counter = numberOfPayout;
// calc compound interest
while (counter > 0) {
output = output.add(output.mul(m_interestRateNumerator).div(INTEREST_RATE_DENOMINATOR));
counter = counter.sub(1);
}
// save tax % on exit; output = output * (100-tax) / 100;
output = output.mul(uint256(100).sub(PERCENT_TAX_ON_EXIT)).div(100);
}
/**
* @dev The game go no next level.
*/
function nextLevel() private {
m_playersStorage.kill();
m_playersStorage = (new PlayersStorage());
m_level = m_level.add(1);
m_interestRateNumerator = calcInterestRateNumerator(m_level);
m_levelStartupTimestamp = now;
NewLevel(now, m_level);
}
/**
* @dev Calc numerator of interest rate for specified level.
* @param newLevel Specified level.
* @return Result numerator.
*/
function calcInterestRateNumerator(uint256 newLevel)
internal
pure
returns(uint256 numerator)
{
// constant INTEREST_RATE_DENOMINATOR = 1000
// numerator we calc
//
// level 1 : 5% interest rate = 50 / 1000 |
// level 2 : 4% interest rate = 40 / 1000 | first stage
// ... |
// level 5 : 1% interest rate = 10 / 1000 |
// level 6 : 0.9% interest rate = 9 / 1000 | second stage
// level 7 : 0.8% interest rate = 8 / 1000 |
// ... |
// level 14 : 0.1% interest rate = 1 / 1000 |
// level >14 : 0.1% interest rate = 1 / 1000 | third stage
if (newLevel <= 5) {
// first stage from 5% to 1%. numerator from 50 to 10
numerator = uint256(6).sub(newLevel).mul(10);
} else if ( newLevel >= 6 && newLevel <= 14) {
// second stage from 0.9% to 0.1%. numerator from 9 to 1
numerator = uint256(15).sub(newLevel);
} else {
// third stage 0.1%. numerator 1
numerator = 1;
}
}
/**
* @dev Convert Ponzi token to wei.
* @param tokensAmount Amout of tokens.
* @param tokenPrice One token price in wei.
* @return weiAmount Result of convertation.
*/
function ponziToWei(uint256 tokensAmount, uint256 tokenPrice)
internal
pure
returns(uint256 weiAmount)
{
weiAmount = tokensAmount.mul(tokenPrice);
}
/**
* @dev Conver bytes data to address.
* @param source Bytes data.
* @return Result address of convertation.
*/
function bytesToAddress(bytes source) internal pure returns(address parsedReferer) {
assembly {
parsedReferer := mload(add(source,0x14))
}
return parsedReferer;
}
} | contract TheGame is ERC677Recipient {
using SafeMath for uint256;
enum State {
NotActive, //NotActive
Active //Active
}
State private m_state;
address private m_owner;
uint256 private m_level;
PlayersStorage private m_playersStorage;
PonziTokenMinInterface private m_ponziToken;
uint256 private m_interestRateNumerator;
uint256 private constant INTEREST_RATE_DENOMINATOR = 1000;
uint256 private m_creationTimestamp;
uint256 private constant DURATION_TO_ACCESS_FOR_OWNER = 144 days;
uint256 private constant COMPOUNDING_FREQ = 1 days;
uint256 private constant DELAY_ON_EXIT = 100 hours;
uint256 private constant DELAY_ON_NEW_LEVEL = 7 days;
string private constant NOT_ACTIVE_STR = "NotActive";
uint256 private constant PERCENT_TAX_ON_EXIT = 10;
string private constant ACTIVE_STR = "Active";
uint256 private constant PERCENT_REFERRAL_BOUNTY = 1;
uint256 private m_levelStartupTimestamp;
uint256 private m_ponziPriceInWei;
address private m_priceSetter;
////////////////
// EVENTS
//
event NewPlayer(address indexed addr, uint256 input, uint256 when);
event DeletePlayer(address indexed addr, uint256 when);
event NewLevel(uint256 when, uint256 newLevel);
event StateChanged(address indexed who, State newState);
event PonziPriceChanged(address indexed who, uint256 newPrice);
////////////////
// MODIFIERS - Restricting Access and State Machine patterns
//
modifier onlyOwner() {
require(msg.sender == m_owner);
_;
}
modifier onlyPonziToken() {
require(msg.sender == address(m_ponziToken));
_;
}
modifier atState(State state) {
require(m_state == state);
_;
}
modifier checkAccess() {
require(m_state == State.NotActive // solium-disable-line indentation, operator-whitespace
|| now.sub(m_creationTimestamp) <= DURATION_TO_ACCESS_FOR_OWNER);
_;
}
modifier isPlayer(address addr) {
require(m_playersStorage.playerExist(addr));
_;
}
modifier gameIsAvailable() {
require(now >= m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL));
_;
}
///////////////
// CONSTRUCTOR
//
/**
* @dev Constructor PonziToken.
*/
function TheGame(address ponziTokenAddr) public {
require(ponziTokenAddr != address(0));
m_ponziToken = PonziTokenMinInterface(ponziTokenAddr);
m_owner = msg.sender;
m_creationTimestamp = now;
m_state = State.NotActive;
m_level = 1;
m_interestRateNumerator = calcInterestRateNumerator(m_level);
}
/**
* @dev Fallback func can recive eth only from Ponzi token
*/
function() public payable onlyPonziToken() { }
/**
* Contract calc output of sender and transfer token/eth it to him.
* If token/ethnot enough on balance, then transfer all and gp to next level.
*
* @dev Sender exit from the game. Sender must be player.
*/
function exit()
external
atState(State.Active)
gameIsAvailable()
isPlayer(msg.sender)
{
uint256 input;
uint256 timestamp;
timestamp = m_playersStorage.playerTimestamp(msg.sender);
input = m_playersStorage.playerInput(msg.sender);
// Check whether the player is DELAY_ON_EXIT hours in the game
require(now >= timestamp.add(DELAY_ON_EXIT));
// calc output
uint256 outputInPonzi = calcOutput(input, now.sub(timestamp).div(COMPOUNDING_FREQ));
assert(outputInPonzi > 0);
// convert ponzi to eth
uint256 outputInWei = ponziToWei(outputInPonzi, m_ponziPriceInWei);
// set zero before sending to prevent Re-Entrancy
m_playersStorage.deletePlayer(msg.sender);
if (m_ponziPriceInWei > 0 && address(this).balance >= outputInWei) {
// if we have enough eth on address(this).balance
// send it to sender
// WARNING
// untrusted Transfer !!!
uint256 oldBalance = address(this).balance;
msg.sender.transfer(outputInWei);
assert(address(this).balance.add(outputInWei) >= oldBalance);
} else if (m_ponziToken.balanceOf(address(this)) >= outputInPonzi) {
// else if we have enough ponzi on balance
// send it to sender
uint256 oldPonziBalance = m_ponziToken.balanceOf(address(this));
assert(m_ponziToken.transfer(msg.sender, outputInPonzi));
assert(m_ponziToken.balanceOf(address(this)).add(outputInPonzi) == oldPonziBalance);
} else {
// if we dont have nor eth, nor ponzi then transfer all avaliable ponzi to
// msg.sender and go to next Level
assert(m_ponziToken.transfer(msg.sender, m_ponziToken.balanceOf(address(this))));
assert(m_ponziToken.balanceOf(address(this)) == 0);
nextLevel();
}
}
/**
* @dev Get info about specified player.
* @param addr Adrress of specified player.
* @return input Input of specified player.
* @return timestamp Timestamp of specified player.
* @return inGame Whether specified player in game or not.
*/
function playerInfo(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 input, uint256 timestamp, bool inGame)
{
(input, timestamp, inGame) = m_playersStorage.playerInfo(addr);
}
/**
* @dev Get possible output for specified player at now.
* @param addr Adrress of specified player.
* @return input Possible output for specified player at now.
*/
function playerOutputAtNow(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 amount)
{
if (!m_playersStorage.playerExist(addr)) {
return 0;
}
uint256 input = m_playersStorage.playerInput(addr);
uint256 timestamp = m_playersStorage.playerTimestamp(addr);
uint256 numberOfPayout = now.sub(timestamp).div(COMPOUNDING_FREQ);
amount = calcOutput(input, numberOfPayout);
}
/**
* @dev Get delay on opportunity to exit for specified player at now.
* @param addr Adrress of specified player.
* @return input Delay for specified player at now.
*/
function playerDelayOnExit(address addr)
public
view
atState(State.Active)
gameIsAvailable()
returns(uint256 delay)
{
if (!m_playersStorage.playerExist(addr)) {
return 0;
}
uint256 timestamp = m_playersStorage.playerTimestamp(msg.sender);
if (now >= timestamp.add(DELAY_ON_EXIT)) {
delay = 0;
} else {
delay = timestamp.add(DELAY_ON_EXIT).sub(now);
}
}
/**
* Sender try enter to the game.
*
* @dev Sender enter to the game. Sender must not be player.
* @param input Input of new player.
* @param referralAddress The referral address.
*/
function enter(uint256 input, address referralAddress)
external
atState(State.Active)
gameIsAvailable()
{
require(m_ponziToken.transferFrom(msg.sender, address(this), input));
require(newPlayer(msg.sender, input, referralAddress));
}
/**
* @dev Address of the price setter.
* @return Address of the price setter.
*/
function priceSetter() external view returns(address) {
return m_priceSetter;
}
/**
* @dev Price of one Ponzi token in wei.
* @return Price of one Ponzi token in wei.
*/
function ponziPriceInWei()
external
view
atState(State.Active)
returns(uint256)
{
return m_ponziPriceInWei;
}
/**
* @dev Сompounding freq of the game. Olways 1 day.
* @return Compounding freq of the game.
*/
function compoundingFreq()
external
view
atState(State.Active)
returns(uint256)
{
return COMPOUNDING_FREQ;
}
/**
* @dev Interest rate of the game as numerator/denominator.From 5% to 0.1%.
* @return numerator Interest rate numerator of the game.
* @return denominator Interest rate denominator of the game.
*/
function interestRate()
external
view
atState(State.Active)
returns(uint256 numerator, uint256 denominator)
{
numerator = m_interestRateNumerator;
denominator = INTEREST_RATE_DENOMINATOR;
}
/**
* @dev Level of the game.
* @return Level of the game.
*/
function level()
external
view
atState(State.Active)
returns(uint256)
{
return m_level;
}
/**
* @dev Get contract work state.
* @return Contract work state via string.
*/
function state() external view returns(string) {
if (m_state == State.NotActive)
return NOT_ACTIVE_STR;
else
return ACTIVE_STR;
}
/**
* @dev Get timestamp of the level startup.
* @return Timestamp of the level startup.
*/
function levelStartupTimestamp()
external
view
atState(State.Active)
returns(uint256)
{
return m_levelStartupTimestamp;
}
/**
* @dev Get amount of Ponzi tokens in the game.Ponzi tokens balanceOf the game.
* @return Contract work state via string.
*/
function totalPonziInGame()
external
view
returns(uint256)
{
return m_ponziToken.balanceOf(address(this));
}
/**
* @dev Get current delay on new level.
* @return Current delay on new level.
*/
function currentDelayOnNewLevel()
external
view
atState(State.Active)
returns(uint256 delay)
{
if (now >= m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL)) {
delay = 0;
} else {
delay = m_levelStartupTimestamp.add(DELAY_ON_NEW_LEVEL).sub(now);
}
}
///////////////////
// ERC677 ERC677Recipient Methods
//
/**
* see: https://github.com/ethereum/EIPs/issues/677
*
* @dev ERC677 token fallback. Called when received Ponzi token
* and sender try enter to the game.
*
* @param from Received tokens from the address.
* @param amount Amount of recived tokens.
* @param data Received extra data.
* @return Whether successful entrance or not.
*/
function tokenFallback(address from, uint256 amount, bytes data)
public
atState(State.Active)
gameIsAvailable()
onlyPonziToken()
returns (bool)
{
address referralAddress = bytesToAddress(data);
require(newPlayer(from, amount, referralAddress));
return true;
}
/**
* @dev Set price of one Ponzi token in wei.
* @param newPrice Price of one Ponzi token in wei.
*/
function setPonziPriceinWei(uint256 newPrice)
public
atState(State.Active)
{
require(msg.sender == m_owner || msg.sender == m_priceSetter);
m_ponziPriceInWei = newPrice;
PonziPriceChanged(msg.sender, m_ponziPriceInWei);
}
/**
* @dev Owner do disown.
*/
function disown() public onlyOwner() atState(State.Active) {
delete m_owner;
}
/**
* @dev Set state of contract working.
* @param newState String representation of new state.
*/
function setState(string newState) public onlyOwner() checkAccess() {
if (keccak256(newState) == keccak256(NOT_ACTIVE_STR)) {
m_state = State.NotActive;
} else if (keccak256(newState) == keccak256(ACTIVE_STR)) {
if (address(m_playersStorage) == address(0))
m_playersStorage = (new PlayersStorage());
m_state = State.Active;
} else {
// if newState not valid string
revert();
}
StateChanged(msg.sender, m_state);
}
/**
* @dev Set the PriceSetter address, which has access to set one Ponzi
* token price in wei.
* @param newPriceSetter The address of new PriceSetter.
*/
function setPriceSetter(address newPriceSetter)
public
onlyOwner()
checkAccess()
atState(State.Active)
{
m_priceSetter = newPriceSetter;
}
/**
* @dev Try create new player.
* @param addr Adrress of pretender player.
* @param inputAmount Input tokens amount of pretender player.
* @param referralAddr Referral address of pretender player.
* @return Whether specified player in game or not.
*/
function newPlayer(address addr, uint256 inputAmount, address referralAddr)
private
returns(bool)
{
uint256 input = inputAmount;
// return false if player already in game or if input < 1000,
// because calcOutput() use INTEREST_RATE_DENOMINATOR = 1000.
// and input must div by INTEREST_RATE_DENOMINATOR, if
// input <1000 then dividing always equal 0.
if (m_playersStorage.playerExist(addr) || input < 1000)
return false;
// check if referralAddr is player
if (m_playersStorage.playerExist(referralAddr)) {
// transfer 1% input form addr to referralAddr :
// newPlayerInput = input * (100-PERCENT_REFERRAL_BOUNTY) %;
// referralInput = (current referral input) + input * PERCENT_REFERRAL_BOUNTY %
uint256 newPlayerInput = inputAmount.mul(uint256(100).sub(PERCENT_REFERRAL_BOUNTY)).div(100);
uint256 referralInput = m_playersStorage.playerInput(referralAddr);
referralInput = referralInput.add(inputAmount.sub(newPlayerInput));
// try set input of referralAddr player
assert(m_playersStorage.playerSetInput(referralAddr, referralInput));
// if success, set input of new player = newPlayerInput
input = newPlayerInput;
}
// try create new player
assert(m_playersStorage.newPlayer(addr, input, now));
NewPlayer(addr, input, now);
return true;
}
/**
* @dev Calc possibly output (compounding interest) for specified input and number of payout.
* @param input Input amount.
* @param numberOfPayout Number of payout.
* @return Possibly output.
*/
function calcOutput(uint256 input, uint256 numberOfPayout)
private
view
returns(uint256 output)
{
output = input;
uint256 counter = numberOfPayout;
// calc compound interest
while (counter > 0) {
output = output.add(output.mul(m_interestRateNumerator).div(INTEREST_RATE_DENOMINATOR));
counter = counter.sub(1);
}
// save tax % on exit; output = output * (100-tax) / 100;
output = output.mul(uint256(100).sub(PERCENT_TAX_ON_EXIT)).div(100);
}
/**
* @dev The game go no next level.
*/
function nextLevel() private {
m_playersStorage.kill();
m_playersStorage = (new PlayersStorage());
m_level = m_level.add(1);
m_interestRateNumerator = calcInterestRateNumerator(m_level);
m_levelStartupTimestamp = now;
NewLevel(now, m_level);
}
/**
* @dev Calc numerator of interest rate for specified level.
* @param newLevel Specified level.
* @return Result numerator.
*/
function calcInterestRateNumerator(uint256 newLevel)
internal
pure
returns(uint256 numerator)
{
// constant INTEREST_RATE_DENOMINATOR = 1000
// numerator we calc
//
// level 1 : 5% interest rate = 50 / 1000 |
// level 2 : 4% interest rate = 40 / 1000 | first stage
// ... |
// level 5 : 1% interest rate = 10 / 1000 |
// level 6 : 0.9% interest rate = 9 / 1000 | second stage
// level 7 : 0.8% interest rate = 8 / 1000 |
// ... |
// level 14 : 0.1% interest rate = 1 / 1000 |
// level >14 : 0.1% interest rate = 1 / 1000 | third stage
if (newLevel <= 5) {
// first stage from 5% to 1%. numerator from 50 to 10
numerator = uint256(6).sub(newLevel).mul(10);
} else if ( newLevel >= 6 && newLevel <= 14) {
// second stage from 0.9% to 0.1%. numerator from 9 to 1
numerator = uint256(15).sub(newLevel);
} else {
// third stage 0.1%. numerator 1
numerator = 1;
}
}
/**
* @dev Convert Ponzi token to wei.
* @param tokensAmount Amout of tokens.
* @param tokenPrice One token price in wei.
* @return weiAmount Result of convertation.
*/
function ponziToWei(uint256 tokensAmount, uint256 tokenPrice)
internal
pure
returns(uint256 weiAmount)
{
weiAmount = tokensAmount.mul(tokenPrice);
}
/**
* @dev Conver bytes data to address.
* @param source Bytes data.
* @return Result address of convertation.
*/
function bytesToAddress(bytes source) internal pure returns(address parsedReferer) {
assembly {
parsedReferer := mload(add(source,0x14))
}
return parsedReferer;
}
} | 15,012 |
25 | // assemble the given address bytecode. If bytecode exists then the _addr is a contract. | function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
| function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
| 24,652 |
22 | // Function used to view the rank associated with `tokenId`. / | function getRank(uint256 tokenId) external view returns (uint256);
| function getRank(uint256 tokenId) external view returns (uint256);
| 34,935 |
9 | // Execute an access removal transaction | function execute(address target, address[] calldata contacts, bytes4[][] calldata permissions)
external override auth
| function execute(address target, address[] calldata contacts, bytes4[][] calldata permissions)
external override auth
| 5,765 |
28 | // Being a normal transfer, the Transfer() and BalanceTransfer() are emitted so no need to emit a specific event here | _transfer(from, to, value, false);
emit Transfer(from, to, value);
| _transfer(from, to, value, false);
emit Transfer(from, to, value);
| 76,688 |
21 | // Fallback method will buyout tokens | function() external payable {
revert();
}
| function() external payable {
revert();
}
| 58,235 |
31 | // NOTE: Optionally, compute additional fee here | return 200_000_000_000_000_000; // 0.2 LINK
| return 200_000_000_000_000_000; // 0.2 LINK
| 22,498 |
148 | // If `account` had not been already granted `role`, emits a {RoleGranted}event. Note that unlike {grantRole}, this function doesn't perform anychecks on the calling account. May emit a {RoleGranted} event. [WARNING]====This function should only be called from the constructor when settingup the initial roles for the system. Using this function in any other way is effectively circumventing the adminsystem imposed by {AccessControl}.==== NOTE: This function is deprecated in favor of {_grantRole}. / | function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
| 18,116 |
149 | // minting presale NFT | _totalSASPresale[msg.sender] = _totalSASPresale[msg.sender] + _mintAmount;
_safeMint(msg.sender, _mintAmount);
| _totalSASPresale[msg.sender] = _totalSASPresale[msg.sender] + _mintAmount;
_safeMint(msg.sender, _mintAmount);
| 71,540 |
40 | // internal variables | uint256 _totalSupply;
mapping(address => uint256) _balances;
| uint256 _totalSupply;
mapping(address => uint256) _balances;
| 20,188 |
69 | // Revert if authorized[msg.sender] == false | if iszero(sload(keccak256(0, 64))) {
| if iszero(sload(keccak256(0, 64))) {
| 3,771 |
3 | // This function returns who is authorized to set the metadata for your metadata. / | function _canSetContractURI()
internal
view
virtual
override
returns (bool)
| function _canSetContractURI()
internal
view
virtual
override
returns (bool)
| 5,415 |
15 | // Used when there isn't enough CELO voting for an account's strategyto fulfill a withdrawal. / | error CantWithdrawAccordingToStrategy();
| error CantWithdrawAccordingToStrategy();
| 19,151 |
213 | // Approve balancer pool to manage mUSD in this contract | _approveMax(musd, balancerPool);
| _approveMax(musd, balancerPool);
| 44,774 |
2 | // MODIFIED | managementContract = IManagementContract(managementContractAddress); // ADDED
__ERC20PresetMinterPauser_init(name, symbol);
| managementContract = IManagementContract(managementContractAddress); // ADDED
__ERC20PresetMinterPauser_init(name, symbol);
| 34,221 |
24 | // Admin wallet contract allowing whitelisting and topping up ofaddresses / | contract AdminWallet is IdentityGuard {
using Roles for Roles.Role;
using SafeMath for uint256;
Roles.Role private admins;
address payable[] adminlist;
SignUpBonus bonus = SignUpBonus(0);
uint256 public toppingAmount;
uint256 public adminToppingAmount;
uint256 public toppingTimes;
uint256 public currentDay;
uint256 public periodStart;
mapping(uint256 => mapping(address => uint256)) toppings;
event AdminsAdded(address payable[] indexed admins);
event AdminsRemoved(address[] indexed admins);
event WalletTopped(address indexed user, uint256 amount);
event GenericCall(
address indexed _contract,
bytes _data,
uint256 _value,
bool _success
);
constructor(
address payable[] memory _admins,
uint256 _toppingAmount,
uint256 _toppingTimes,
Identity _identity
) public IdentityGuard(_identity) {
toppingAmount = _toppingAmount;
adminToppingAmount = 1e9 * 9e6; //1gwei gas price * 9000000 gas limit
toppingTimes = _toppingTimes;
periodStart = now;
if (_admins.length > 0) {
addAdmins(_admins);
}
}
/* @dev Modifier that checks if caller is admin of wallet
*/
modifier onlyAdmin() {
require(isAdmin(msg.sender), "Caller is not admin");
_;
}
modifier reimburseGas() {
_;
if (msg.sender.balance <= adminToppingAmount.div(2) && isAdmin(msg.sender)) {
_topWallet(msg.sender);
}
}
function() external payable {}
/* @dev Internal function that sets current day
*/
function setDay() internal {
currentDay = (now.sub(periodStart)) / 1 days;
}
function setBonusContract(SignUpBonus _bonus) public onlyOwner {
bonus = _bonus;
}
/* @dev Function to add list of addresses to admins
* can only be called by creator of contract
* @param _admins the list of addresses to add
*/
function addAdmins(address payable[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
if (isAdmin(_admins[i]) == false) {
admins.add(_admins[i]);
adminlist.push(_admins[i]);
}
}
emit AdminsAdded(_admins);
}
/* @dev Function to remove list of addresses to admins
* can only be called by creator of contract
* @param _admins the list of addresses to remove
*/
function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
admins.remove(_admins[i]);
}
emit AdminsRemoved(_admins);
}
/**
* @dev top admins
*/
function topAdmins(uint256 startIndex, uint256 endIndex) public reimburseGas {
require(adminlist.length > startIndex, "Admin list is empty");
for (uint256 i = startIndex; (i < adminlist.length && i < endIndex); i++) {
if (
isAdmin(adminlist[i]) && adminlist[i].balance <= adminToppingAmount.div(2)
) {
_topWallet(adminlist[i]);
}
}
}
/* @dev top the first 50 admins
*/
function topAdmins(uint256 startIndex) public reimburseGas {
topAdmins(startIndex, startIndex + 50);
}
/**
* @dev Function to check if given address is an admin
* @param _user the address to check
* @return A bool indicating if user is an admin
*/
function isAdmin(address _user) public view returns (bool) {
return admins.has(_user);
}
/* @dev Function to add given address to whitelist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function whitelist(address _user, string memory _did) public onlyAdmin reimburseGas {
identity.addWhitelistedWithDID(_user, _did);
}
/* @dev Function to remove given address from whitelist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function removeWhitelist(address _user) public onlyAdmin reimburseGas {
identity.removeWhitelisted(_user);
}
/* @dev Function to add given address to blacklist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function blacklist(address _user) public onlyAdmin reimburseGas {
identity.addBlacklisted(_user);
}
/* @dev Function to remove given address from blacklist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function removeBlacklist(address _user) public onlyAdmin reimburseGas {
identity.removeBlacklisted(_user);
}
/* @dev Function to top given address with amount of G$ given in constructor
* can only be done by admin the amount of times specified in constructor per day
* @param _user The address to transfer to
*/
function topWallet(address payable _user) public onlyAdmin reimburseGas {
setDay();
require(
toppings[currentDay][_user] < toppingTimes,
"User wallet has been topped too many times today"
);
if (address(_user).balance >= toppingAmount.div(4)) return;
_topWallet(_user);
}
function _topWallet(address payable _wallet) internal {
toppings[currentDay][_wallet] += 1;
uint256 amount = isAdmin(_wallet) ? adminToppingAmount : toppingAmount;
uint256 toTop = amount.sub(address(_wallet).balance);
_wallet.transfer(toTop);
emit WalletTopped(_wallet, toTop);
}
/* @dev Function to whitelist user and also award him pending bonuses, it can be used also later
* when user is already whitelisted to just award pending bonuses
* can only be done by admin
* @param _user The address to transfer to and whitelist
* @param _amount the bonus amount to give
* @param _did decentralized id of user, pointer to some profile
*/
function whitelistAndAwardUser(
address _user,
uint256 _amount,
string memory _did
) public onlyAdmin reimburseGas {
require(bonus != SignUpBonus(0), "SignUp bonus has not been set yet");
if (identity.isWhitelisted(_user) == false) {
whitelist(_user, _did);
}
if (_amount > 0) {
bonus.awardUser(_user, _amount);
}
}
/**
* @dev Function to award user with pending bonuses,
* can only be done by admin
* @param _user The address to transfer to and whitelist
* @param _amount the bonus amount to give
*/
function awardUser(address _user, uint256 _amount) public onlyAdmin reimburseGas {
require(bonus != SignUpBonus(0), "SignUp bonus has not been set yet");
if (_amount > 0) {
bonus.awardUser(_user, _amount);
}
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(
address _contract,
bytes memory _data,
uint256 _value
) public onlyAdmin reimburseGas returns (bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev destroy wallet and return funds to owner
*/
function destroy() public onlyOwner {
selfdestruct(msg.sender);
}
}
| contract AdminWallet is IdentityGuard {
using Roles for Roles.Role;
using SafeMath for uint256;
Roles.Role private admins;
address payable[] adminlist;
SignUpBonus bonus = SignUpBonus(0);
uint256 public toppingAmount;
uint256 public adminToppingAmount;
uint256 public toppingTimes;
uint256 public currentDay;
uint256 public periodStart;
mapping(uint256 => mapping(address => uint256)) toppings;
event AdminsAdded(address payable[] indexed admins);
event AdminsRemoved(address[] indexed admins);
event WalletTopped(address indexed user, uint256 amount);
event GenericCall(
address indexed _contract,
bytes _data,
uint256 _value,
bool _success
);
constructor(
address payable[] memory _admins,
uint256 _toppingAmount,
uint256 _toppingTimes,
Identity _identity
) public IdentityGuard(_identity) {
toppingAmount = _toppingAmount;
adminToppingAmount = 1e9 * 9e6; //1gwei gas price * 9000000 gas limit
toppingTimes = _toppingTimes;
periodStart = now;
if (_admins.length > 0) {
addAdmins(_admins);
}
}
/* @dev Modifier that checks if caller is admin of wallet
*/
modifier onlyAdmin() {
require(isAdmin(msg.sender), "Caller is not admin");
_;
}
modifier reimburseGas() {
_;
if (msg.sender.balance <= adminToppingAmount.div(2) && isAdmin(msg.sender)) {
_topWallet(msg.sender);
}
}
function() external payable {}
/* @dev Internal function that sets current day
*/
function setDay() internal {
currentDay = (now.sub(periodStart)) / 1 days;
}
function setBonusContract(SignUpBonus _bonus) public onlyOwner {
bonus = _bonus;
}
/* @dev Function to add list of addresses to admins
* can only be called by creator of contract
* @param _admins the list of addresses to add
*/
function addAdmins(address payable[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
if (isAdmin(_admins[i]) == false) {
admins.add(_admins[i]);
adminlist.push(_admins[i]);
}
}
emit AdminsAdded(_admins);
}
/* @dev Function to remove list of addresses to admins
* can only be called by creator of contract
* @param _admins the list of addresses to remove
*/
function removeAdmins(address[] memory _admins) public onlyOwner {
for (uint256 i = 0; i < _admins.length; i++) {
admins.remove(_admins[i]);
}
emit AdminsRemoved(_admins);
}
/**
* @dev top admins
*/
function topAdmins(uint256 startIndex, uint256 endIndex) public reimburseGas {
require(adminlist.length > startIndex, "Admin list is empty");
for (uint256 i = startIndex; (i < adminlist.length && i < endIndex); i++) {
if (
isAdmin(adminlist[i]) && adminlist[i].balance <= adminToppingAmount.div(2)
) {
_topWallet(adminlist[i]);
}
}
}
/* @dev top the first 50 admins
*/
function topAdmins(uint256 startIndex) public reimburseGas {
topAdmins(startIndex, startIndex + 50);
}
/**
* @dev Function to check if given address is an admin
* @param _user the address to check
* @return A bool indicating if user is an admin
*/
function isAdmin(address _user) public view returns (bool) {
return admins.has(_user);
}
/* @dev Function to add given address to whitelist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function whitelist(address _user, string memory _did) public onlyAdmin reimburseGas {
identity.addWhitelistedWithDID(_user, _did);
}
/* @dev Function to remove given address from whitelist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function removeWhitelist(address _user) public onlyAdmin reimburseGas {
identity.removeWhitelisted(_user);
}
/* @dev Function to add given address to blacklist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function blacklist(address _user) public onlyAdmin reimburseGas {
identity.addBlacklisted(_user);
}
/* @dev Function to remove given address from blacklist of identity contract
* can only be done by admins of wallet and if wallet is an IdentityAdmin
*/
function removeBlacklist(address _user) public onlyAdmin reimburseGas {
identity.removeBlacklisted(_user);
}
/* @dev Function to top given address with amount of G$ given in constructor
* can only be done by admin the amount of times specified in constructor per day
* @param _user The address to transfer to
*/
function topWallet(address payable _user) public onlyAdmin reimburseGas {
setDay();
require(
toppings[currentDay][_user] < toppingTimes,
"User wallet has been topped too many times today"
);
if (address(_user).balance >= toppingAmount.div(4)) return;
_topWallet(_user);
}
function _topWallet(address payable _wallet) internal {
toppings[currentDay][_wallet] += 1;
uint256 amount = isAdmin(_wallet) ? adminToppingAmount : toppingAmount;
uint256 toTop = amount.sub(address(_wallet).balance);
_wallet.transfer(toTop);
emit WalletTopped(_wallet, toTop);
}
/* @dev Function to whitelist user and also award him pending bonuses, it can be used also later
* when user is already whitelisted to just award pending bonuses
* can only be done by admin
* @param _user The address to transfer to and whitelist
* @param _amount the bonus amount to give
* @param _did decentralized id of user, pointer to some profile
*/
function whitelistAndAwardUser(
address _user,
uint256 _amount,
string memory _did
) public onlyAdmin reimburseGas {
require(bonus != SignUpBonus(0), "SignUp bonus has not been set yet");
if (identity.isWhitelisted(_user) == false) {
whitelist(_user, _did);
}
if (_amount > 0) {
bonus.awardUser(_user, _amount);
}
}
/**
* @dev Function to award user with pending bonuses,
* can only be done by admin
* @param _user The address to transfer to and whitelist
* @param _amount the bonus amount to give
*/
function awardUser(address _user, uint256 _amount) public onlyAdmin reimburseGas {
require(bonus != SignUpBonus(0), "SignUp bonus has not been set yet");
if (_amount > 0) {
bonus.awardUser(_user, _amount);
}
}
/**
* @dev perform a generic call to an arbitrary contract
* @param _contract the contract's address to call
* @param _data ABI-encoded contract call to call `_contract` address.
* @param _value value (ETH) to transfer with the transaction
* @return bool success or fail
* bytes - the return bytes of the called contract's function.
*/
function genericCall(
address _contract,
bytes memory _data,
uint256 _value
) public onlyAdmin reimburseGas returns (bool success, bytes memory returnValue) {
// solhint-disable-next-line avoid-call-value
(success, returnValue) = _contract.call.value(_value)(_data);
emit GenericCall(_contract, _data, _value, success);
}
/**
* @dev destroy wallet and return funds to owner
*/
function destroy() public onlyOwner {
selfdestruct(msg.sender);
}
}
| 29,700 |
187 | // set CarPerBlock | function setPerParam(uint256 _amount) public onlyOwner {
carPerBlock = _amount;
}
| function setPerParam(uint256 _amount) public onlyOwner {
carPerBlock = _amount;
}
| 37,211 |
83 | // Aave v1 data | uint256 currentBorrowBalance;
uint256 principalBorrowBalance;
uint256 borrowRateMode;
uint256 borrowRate;
uint256 originationFee;
| uint256 currentBorrowBalance;
uint256 principalBorrowBalance;
uint256 borrowRateMode;
uint256 borrowRate;
uint256 originationFee;
| 36,079 |
26 | // Shift the bytes over to match the item size. | if lt(itemLength, 32) {
out := div(out, exp(256, sub(32, itemLength)))
}
| if lt(itemLength, 32) {
out := div(out, exp(256, sub(32, itemLength)))
}
| 18,278 |
49 | // returns excessive ETH | msg.sender.transfer(msg.value - (amount * tokenPrice));
chooseWinner();
| msg.sender.transfer(msg.value - (amount * tokenPrice));
chooseWinner();
| 21,416 |
22 | // Internal function invoked by {submitOrder} | function _submitOrder(OrderStore.Order memory params) internal returns (uint256, uint256) {
| function _submitOrder(OrderStore.Order memory params) internal returns (uint256, uint256) {
| 7,071 |
0 | // Initialize contract/owner Contract owner, can conduct administrative functions./beneficiary Recieves a proportion of incoming tokens on buy() and pay() operations./collateralToken Token accepted as collateral by the curve. (e.g. WETH or DAI)/bondedToken Token native to the curve. The bondingCurve contract has exclusive rights to mint and burn tokens./buyCurve Curve logic for buy curve./sellCurve Curve logic for sell curve./dividendPool Pool to recieve and allocate tokens for bonded token holders./splitOnPay Percentage of incoming collateralTokens distributed to beneficiary on pay(). The remainder being distributed among current bondedToken holders. Divided by precision value. | function initialize(
address owner,
address beneficiary,
IERC20 collateralToken,
BondedToken bondedToken,
ICurveLogic buyCurve,
ICurveLogic sellCurve,
DividendPool dividendPool,
uint256 splitOnPay
| function initialize(
address owner,
address beneficiary,
IERC20 collateralToken,
BondedToken bondedToken,
ICurveLogic buyCurve,
ICurveLogic sellCurve,
DividendPool dividendPool,
uint256 splitOnPay
| 12,355 |
27 | // 加入玩家(場主) | _recruit.players.push(Player(HOST_ADDRESS, false));
| _recruit.players.push(Player(HOST_ADDRESS, false));
| 10,496 |
14 | // Returns array of quantities in specified order / | function getCurrentQuantities(address[] memory _tokens, uint256 _totalUnits)
public
view
returns (uint256[] memory)
| function getCurrentQuantities(address[] memory _tokens, uint256 _totalUnits)
public
view
returns (uint256[] memory)
| 33,909 |
4 | // solhint-enable max-line-length |
function take0xV2Trade(
address trader,
address vaultAddress,
uint256 sourceTokenAmountToUse,
OrderV2[] memory orders0x, // Array of 0x V2 order structs
bytes[] memory signatures0x) // Array of signatures for each of the V2 orders
public
returns (
address destTokenAddress,
|
function take0xV2Trade(
address trader,
address vaultAddress,
uint256 sourceTokenAmountToUse,
OrderV2[] memory orders0x, // Array of 0x V2 order structs
bytes[] memory signatures0x) // Array of signatures for each of the V2 orders
public
returns (
address destTokenAddress,
| 12,536 |
17 | // Parcel has shipped to buyer | function shipParcel()
public
onlySeller
inState(State.Assembly)
| function shipParcel()
public
onlySeller
inState(State.Assembly)
| 28,655 |
2 | // An abbreviated name for NFTs in this contract | function symbol() external view returns (string memory __symbol);
| function symbol() external view returns (string memory __symbol);
| 12,765 |
4 | // |
UsersMine memory user2 = UsersMine({
id: newSlotId_ap2,
referrerId: uint(0),
reinvestCount: uint(0)
});
|
UsersMine memory user2 = UsersMine({
id: newSlotId_ap2,
referrerId: uint(0),
reinvestCount: uint(0)
});
| 28,924 |
75 | // Reverts the transaction with return data set to the ABI encoding of the status argument (and revert reason data) / | function revertWithStatus(RelayCallStatus status, bytes memory ret) private pure {
bytes memory data = abi.encode(status, ret);
GsnEip712Library.truncateInPlace(data);
assembly {
let dataSize := mload(data)
let dataPtr := add(data, 32)
revert(dataPtr, dataSize)
}
}
| function revertWithStatus(RelayCallStatus status, bytes memory ret) private pure {
bytes memory data = abi.encode(status, ret);
GsnEip712Library.truncateInPlace(data);
assembly {
let dataSize := mload(data)
let dataPtr := add(data, 32)
revert(dataPtr, dataSize)
}
}
| 9,921 |
154 | // send loan tokens to proxy | for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| for (uint256 i = 0; i < borrowAssets.length; i++) {
ERC20(borrowAssets[i]).safeTransfer(initiator, amounts[i]);
}
| 27,642 |
286 | // Generate a unique ID: | bytes32 proposalId = keccak256(abi.encodePacked(this, proposalsCnt));
proposalsCnt++;
| bytes32 proposalId = keccak256(abi.encodePacked(this, proposalsCnt));
proposalsCnt++;
| 20,660 |
34 | // ShareBonus(SHARE_BONUS_TIME, this.balance); | }
| }
| 24,959 |
215 | // Add to whitelist / | function addToWhitelist(address[] calldata toAddAddresses)
external
{
require(msg.sender == owner, "not owner");
for (uint i = 0; i < toAddAddresses.length; i++) {
whitelist[toAddAddresses[i]] = true;
}
| function addToWhitelist(address[] calldata toAddAddresses)
external
{
require(msg.sender == owner, "not owner");
for (uint i = 0; i < toAddAddresses.length; i++) {
whitelist[toAddAddresses[i]] = true;
}
| 7,952 |
116 | // The block number when DRUG mining starts. | uint256 public startBlock;
uint256 public bonusMultiplierEndBlock;
uint256 public lastBonusMultiplerBlock = 0;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
| uint256 public startBlock;
uint256 public bonusMultiplierEndBlock;
uint256 public lastBonusMultiplerBlock = 0;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
| 10,051 |
81 | // Duplicated deposits | require(!depositsSigned(hashSender));
setDepositsSigned(hashSender, true);
uint256 signed = numDepositsSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| require(!depositsSigned(hashSender));
setDepositsSigned(hashSender, true);
uint256 signed = numDepositsSigned(hashMsg);
require(!isAlreadyProcessed(signed));
| 41,454 |
135 | // amount of token or ETH users deposited | uint256 balance;
| uint256 balance;
| 58,176 |
105 | // Returns the total value of assets in want tokens/it should include the current balance of want tokens, the assets that are deployed and value of rewards so far | function estimatedTotalAssets() public view virtual override returns (uint256) {
return _balanceOfWant() + _balanceOfPool() + _balanceOfRewards();
}
| function estimatedTotalAssets() public view virtual override returns (uint256) {
return _balanceOfWant() + _balanceOfPool() + _balanceOfRewards();
}
| 53,157 |
1 | // Swap the amount of the ERC20 token for another ERC20 on Uniswap V3 as long as Maximum_Slippage isn’t exceeded route uniswap route to follow for the swapreturn amountReceived - amount received and transfered to the vault / | function trade(bytes calldata route) external onlyOwner returns(uint256 amountReceived) {
(address token0, , ) = route.decodeFirstPool();
uint256 amountSend = IERC20(token0).balanceOf(address(this));
( address token1, uint256 withoutSlippage ) = spotForRoute(amountSend, route);
uint256 allowSlippage = withoutSlippage.mul(maxSlippage).div(PRECISION);
uint256 minAmountOut = withoutSlippage.sub(allowSlippage);
TransferHelper.safeApprove(token0, swapRouter, amountSend);
ISwapRouter.ExactInputParams memory params =
ISwapRouter.ExactInputParams({
path: route,
recipient: address(this),
deadline: block.timestamp,
amountIn: amountSend,
amountOutMinimum: minAmountOut
});
amountReceived = ISwapRouter(swapRouter).exactInput(params);
emit Trade(msg.sender, token0, amountSend, token1, amountReceived);
}
| function trade(bytes calldata route) external onlyOwner returns(uint256 amountReceived) {
(address token0, , ) = route.decodeFirstPool();
uint256 amountSend = IERC20(token0).balanceOf(address(this));
( address token1, uint256 withoutSlippage ) = spotForRoute(amountSend, route);
uint256 allowSlippage = withoutSlippage.mul(maxSlippage).div(PRECISION);
uint256 minAmountOut = withoutSlippage.sub(allowSlippage);
TransferHelper.safeApprove(token0, swapRouter, amountSend);
ISwapRouter.ExactInputParams memory params =
ISwapRouter.ExactInputParams({
path: route,
recipient: address(this),
deadline: block.timestamp,
amountIn: amountSend,
amountOutMinimum: minAmountOut
});
amountReceived = ISwapRouter(swapRouter).exactInput(params);
emit Trade(msg.sender, token0, amountSend, token1, amountReceived);
}
| 31,670 |
435 | // Globals / Address of the media contract that can call this market | address public mediaContract;
| address public mediaContract;
| 24,853 |
31 | // Number of accept votes. | uint96 votes; // -1 == vetoed
| uint96 votes; // -1 == vetoed
| 31,457 |
36 | // Increasing amount withdrawn by the investor. | withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
| withdrawn[msg.sender] = withdrawn[msg.sender].add(amountToWithdraw);
| 19,592 |
36 | // In case someone transfers tokens in directly, which will cause the dispatch reverted, we burn all the tokens in the contract here. | uint burnAmount = IERC20(underlying).balanceOf(address(this));
address burner = burners[cToken];
if (manualBurn[cToken]) {
| uint burnAmount = IERC20(underlying).balanceOf(address(this));
address burner = burners[cToken];
if (manualBurn[cToken]) {
| 36,156 |
37 | // Payback borrowed ETH/ERC20_Token. token token address to payback.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) amt token amount to payback. getId Get token amount at this ID from `DoughMemory` Contract. setId Set token amount at this ID in `DoughMemory` Contract./ | function payback(
address token,
uint amt,
uint getId,
uint setId
| function payback(
address token,
uint amt,
uint getId,
uint setId
| 18,564 |
7 | // The token decimals in Crab, Darwinia Netowrk is 9, Ethereum is 18. | function decimalsConverter(uint256 darwiniaValue) public pure returns (uint256) {
return SafeMath.mul(darwiniaValue, 1000000000);
}
| function decimalsConverter(uint256 darwiniaValue) public pure returns (uint256) {
return SafeMath.mul(darwiniaValue, 1000000000);
}
| 33,426 |
109 | // Gets the interest rate from the underlying token, IE DAI or USDC. returnThe current interest rate, represented using 18 decimals. Meaning `65000000000000000` is 6.5% APY or 0.065. / | function getInterestRateByUnderlyingTokenAddress(address underlyingToken) external view returns (uint);
| function getInterestRateByUnderlyingTokenAddress(address underlyingToken) external view returns (uint);
| 39,900 |
37 | // Update reward variables of the given pool to be up-to-date. | function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
// If the next reward period has not been elapsed do nothing
if (block.timestamp <= pool.lastRewardTimestamp) {
return;
}
// Reduce the rewards
reduceRewards();
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
uint256 tmpLastRewardTimestamp = pool.lastRewardTimestamp;
uint256 rewardPeriodTime = rewardPeriodMinutes * 1 minutes;
uint256 periodCount = (block.timestamp.sub(tmpLastRewardTimestamp)).div(rewardPeriodTime);
// Shift the reward time to the next timestamp
tmpLastRewardTimestamp = periodCount.add(1).mul(rewardPeriodTime).add(tmpLastRewardTimestamp);
if (lpSupply == 0) {
pool.lastRewardTimestamp = tmpLastRewardTimestamp;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardTimestamp, block.timestamp);
uint256 honReward = (multiplier.mul(honPerPeriod).mul(pool.allocPoint)).div(totalAllocPoint);
// Transfer dev & treasury share
safeHonTransfer(devaddr, (honReward.mul(DEV_SHARE)).div(100));
safeHonTransfer(treasuryaddr, (honReward.mul(TREASURY_SHARE)).div(100));
pool.accHonPerShare = pool.accHonPerShare.add((honReward.mul(1e12)).div(lpSupply));
pool.lastRewardTimestamp = tmpLastRewardTimestamp;
}
| function updatePool(uint256 _pid) public validatePoolByPid(_pid) {
PoolInfo storage pool = poolInfo[_pid];
// If the next reward period has not been elapsed do nothing
if (block.timestamp <= pool.lastRewardTimestamp) {
return;
}
// Reduce the rewards
reduceRewards();
uint256 lpSupply = pool.lpToken.balanceOf(address(this));
uint256 tmpLastRewardTimestamp = pool.lastRewardTimestamp;
uint256 rewardPeriodTime = rewardPeriodMinutes * 1 minutes;
uint256 periodCount = (block.timestamp.sub(tmpLastRewardTimestamp)).div(rewardPeriodTime);
// Shift the reward time to the next timestamp
tmpLastRewardTimestamp = periodCount.add(1).mul(rewardPeriodTime).add(tmpLastRewardTimestamp);
if (lpSupply == 0) {
pool.lastRewardTimestamp = tmpLastRewardTimestamp;
return;
}
uint256 multiplier = getMultiplier(pool.lastRewardTimestamp, block.timestamp);
uint256 honReward = (multiplier.mul(honPerPeriod).mul(pool.allocPoint)).div(totalAllocPoint);
// Transfer dev & treasury share
safeHonTransfer(devaddr, (honReward.mul(DEV_SHARE)).div(100));
safeHonTransfer(treasuryaddr, (honReward.mul(TREASURY_SHARE)).div(100));
pool.accHonPerShare = pool.accHonPerShare.add((honReward.mul(1e12)).div(lpSupply));
pool.lastRewardTimestamp = tmpLastRewardTimestamp;
}
| 899 |
108 | // Deposit staking tokens | function deposit(uint amount)
external
nonReentrant
whenNotPaused
notFrozen(msg.sender)
updateReward(msg.sender)
| function deposit(uint amount)
external
nonReentrant
whenNotPaused
notFrozen(msg.sender)
updateReward(msg.sender)
| 32,245 |
4 | // checks a signed message's validity under a pubkey/does this using ecrecover because Ethereum has no soul/_pubkey the public key to check (64 bytes)/_digest the message digest signed/_vthe signature recovery value/_rthe signature r value/_sthe signature s value/ returntrue if signature is valid, else false | function checkSig(
bytes memory _pubkey,
bytes32 _digest,
uint8 _v,
bytes32 _r,
bytes32 _s
| function checkSig(
bytes memory _pubkey,
bytes32 _digest,
uint8 _v,
bytes32 _r,
bytes32 _s
| 19,612 |
1 | // Modifier to make a function callable only when the contract is paused./ | modifier whenPaused() {
require(paused, "Contract is not paused");
_;
}
| modifier whenPaused() {
require(paused, "Contract is not paused");
_;
}
| 18,787 |
982 | // We don't want EMP deployers to be able to intentionally or unintentionally set liveness periods that could induce arithmetic overflow, but we also don't want to be opinionated about what livenesses are "correct", so we will somewhat arbitrarily set the liveness upper bound to 100 years (5200 weeks). In practice, liveness periods even greater than a few days would make the EMP unusable for most users. | require(params.withdrawalLiveness < 5200 weeks, "Withdrawal liveness too large");
require(params.liquidationLiveness < 5200 weeks, "Liquidation liveness too large");
| require(params.withdrawalLiveness < 5200 weeks, "Withdrawal liveness too large");
require(params.liquidationLiveness < 5200 weeks, "Liquidation liveness too large");
| 17,683 |
222 | // Pause the contract | function pause() external onlyOwner {
paused = true;
}
| function pause() external onlyOwner {
paused = true;
}
| 19,613 |
27 | // IPFS hash of the website - can be accessed even if our domain goes down. Just go to any public IPFS gateway and use this hash - e.g. ipfs.infura.io/ipfs/<ipfsHash> | string public ipfsHash;
string public ipfsHashType = "ipfs"; // can either be ipfs, or ipns
MobiusToken public token;
| string public ipfsHash;
string public ipfsHashType = "ipfs"; // can either be ipfs, or ipns
MobiusToken public token;
| 75,996 |
47 | // ETH : deposit-withdraw ETH | function systemETH() public view returns (uint256){
return address(this).balance;
}
| function systemETH() public view returns (uint256){
return address(this).balance;
}
| 14,482 |
22 | // sets contract address of StabilityPool / | function setStabilityPool(address _stabilityPool) external override onlyOwner {
stabilityPool = IStabilityPool(_stabilityPool);
}
| function setStabilityPool(address _stabilityPool) external override onlyOwner {
stabilityPool = IStabilityPool(_stabilityPool);
}
| 30,920 |
1 | // Basic Types: boolean, uint, int , address, bytesSpecial Types: array, struct, mapping (required data storage)in Solidity string is an array of bytes |
uint256 myFavouriteNumber; //Default is 0
|
uint256 myFavouriteNumber; //Default is 0
| 16,277 |
319 | // Function to withdraw contract funds. _address address to transfer funds to. _amount amount to be transferred in wei. / | function withdrawFunds(address _address, uint256 _amount)
external
onlyOwner
| function withdrawFunds(address _address, uint256 _amount)
external
onlyOwner
| 3,241 |
90 | // Gov Functions //Begins transfer of gov rights. The newPendingGov must call `_acceptGov` to finalize the transfer.Gov function to begin change of gov. The newPendingGov must call `_acceptGov` to finalize the transfer.newPendingGov New pending gov./ | function _setPendingGov(address newPendingGov)
external
| function _setPendingGov(address newPendingGov)
external
| 24,174 |
57 | // if minting an option then no need to transfer (means that we need to mint onExercise instead) | if (mintingOption == 2) {
return;
}
| if (mintingOption == 2) {
return;
}
| 20,855 |
22 | // Get the boost IDs for the staked team. | uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds;
uint8 _boostRate = 0;
| uint16[] memory _boostIds = inStakedteam[_staketeam].boostIds;
uint8 _boostRate = 0;
| 11,688 |
525 | // Check if msg.sender is the current advocate of a Name/TAO ID / | modifier onlyAdvocate(address _id) {
require (senderIsAdvocate(msg.sender, _id));
_;
}
| modifier onlyAdvocate(address _id) {
require (senderIsAdvocate(msg.sender, _id));
_;
}
| 32,661 |
352 | // Get the source of the operator contract's authority./ If the contract uses delegated authority,/ returns the original source of the delegated authority./ If the contract doesn't use delegated authority,/ returns the contract itself./ Authorize `getAuthoritySource(operatorContract)`/ to grant `operatorContract` the authority to penalize an operator. | function getAuthoritySource(
address operatorContract
| function getAuthoritySource(
address operatorContract
| 6,973 |
209 | // store request in the core | requestId= requestCore.createRequest(msg.sender, _payees, _expectedAmounts, _payer, _data);
| requestId= requestCore.createRequest(msg.sender, _payees, _expectedAmounts, _payer, _data);
| 47,276 |
238 | // not first bet in current cycle, add amount | bets_[player].amount = bets_[player].amount.add(value);
| bets_[player].amount = bets_[player].amount.add(value);
| 48,371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.