creation_sourcecode: // SPDX-License-Identifier: MIT
  //https://api.binance.com/api/v3/ticker/price?symbol=BNBBUSD
  
  pragma solidity ^0.8;
  
  contract Context {
      // Empty internal constructor, to prevent people from mistakenly deploying
      // an instance of this contract, which should be used via inheritance.
      function _msgSender() internal view returns (address) {
          return msg.sender;
      }
  
      function _msgData() internal view returns (bytes memory) {
          this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
          return msg.data;
      }
  }
  
  library Address {
      /**
       * @dev Returns true if `account` is a contract.
       *
       * [IMPORTANT]
       * ====
       * It is unsafe to assume that an address for which this function returns
       * false is an externally-owned account (EOA) and not a contract.
       *
       * Among others, `isContract` will return false for the following
       * types of addresses:
       *
       *  - an externally-owned account
       *  - a contract in construction
       *  - an address where a contract will be created
       *  - an address where a contract lived, but was destroyed
       * ====
       *
       * [IMPORTANT]
       * ====
       * You shouldn't rely on `isContract` to protect against flash loan attacks!
       *
       * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
       * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
       * constructor.
       * ====
       */
      function isContract(address account) internal view returns (bool) {
          // This method relies on extcodesize/address.code.length, which returns 0
          // for contracts in construction, since the code is only stored at the end
          // of the constructor execution.
  
          return account.code.length > 0;
      }
  
      /**
       * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
       * `recipient`, forwarding all available gas and reverting on errors.
       *
       * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
       * of certain opcodes, possibly making contracts go over the 2300 gas limit
       * imposed by `transfer`, making them unable to receive funds via
       * `transfer`. {sendValue} removes this limitation.
       *
       * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
       *
       * IMPORTANT: because control is transferred to `recipient`, care must be
       * taken to not create reentrancy vulnerabilities. Consider using
       * {ReentrancyGuard} or the
       * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
       */
      function sendValue(address payable recipient, uint256 amount) internal {
          require(
              address(this).balance >= amount,
              "Address: insufficient balance"
          );
  
          (bool success, ) = recipient.call{value: amount}("");
          require(
              success,
              "Address: unable to send value, recipient may have reverted"
          );
      }
  
      /**
       * @dev Performs a Solidity function call using a low level `call`. A
       * plain `call` is an unsafe replacement for a function call: use this
       * function instead.
       *
       * If `target` reverts with a revert reason, it is bubbled up by this
       * function (like regular Solidity function calls).
       *
       * Returns the raw returned data. To convert to the expected return value,
       * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
       *
       * Requirements:
       *
       * - `target` must be a contract.
       * - calling `target` with `data` must not revert.
       *
       * _Available since v3.1._
       */
      function functionCall(
          address target,
          bytes memory data
      ) internal returns (bytes memory) {
          return functionCall(target, data, "Address: low-level call failed");
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
       * `errorMessage` as a fallback revert reason when `target` reverts.
       *
       * _Available since v3.1._
       */
      function functionCall(
          address target,
          bytes memory data,
          string memory errorMessage
      ) internal returns (bytes memory) {
          return functionCallWithValue(target, data, 0, errorMessage);
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
       * but also transferring `value` wei to `target`.
       *
       * Requirements:
       *
       * - the calling contract must have an ETH balance of at least `value`.
       * - the called Solidity function must be `payable`.
       *
       * _Available since v3.1._
       */
      function functionCallWithValue(
          address target,
          bytes memory data,
          uint256 value
      ) internal returns (bytes memory) {
          return
              functionCallWithValue(
                  target,
                  data,
                  value,
                  "Address: low-level call with value failed"
              );
      }
  
      /**
       * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
       * with `errorMessage` as a fallback revert reason when `target` reverts.
       *
       * _Available since v3.1._
       */
      function functionCallWithValue(
          address target,
          bytes memory data,
          uint256 value,
          string memory errorMessage
      ) internal returns (bytes memory) {
          require(
              address(this).balance >= value,
              "Address: insufficient balance for call"
          );
          require(isContract(target), "Address: call to non-contract");
  
          (bool success, bytes memory returndata) = target.call{value: value}(
              data
          );
          return verifyCallResult(success, returndata, errorMessage);
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
       * but performing a static call.
       *
       * _Available since v3.3._
       */
      function functionStaticCall(
          address target,
          bytes memory data
      ) internal view returns (bytes memory) {
          return
              functionStaticCall(
                  target,
                  data,
                  "Address: low-level static call failed"
              );
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
       * but performing a static call.
       *
       * _Available since v3.3._
       */
      function functionStaticCall(
          address target,
          bytes memory data,
          string memory errorMessage
      ) internal view returns (bytes memory) {
          require(isContract(target), "Address: static call to non-contract");
  
          (bool success, bytes memory returndata) = target.staticcall(data);
          return verifyCallResult(success, returndata, errorMessage);
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
       * but performing a delegate call.
       *
       * _Available since v3.4._
       */
      function functionDelegateCall(
          address target,
          bytes memory data
      ) internal returns (bytes memory) {
          return
              functionDelegateCall(
                  target,
                  data,
                  "Address: low-level delegate call failed"
              );
      }
  
      /**
       * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
       * but performing a delegate call.
       *
       * _Available since v3.4._
       */
      function functionDelegateCall(
          address target,
          bytes memory data,
          string memory errorMessage
      ) internal returns (bytes memory) {
          require(isContract(target), "Address: delegate call to non-contract");
  
          (bool success, bytes memory returndata) = target.delegatecall(data);
          return verifyCallResult(success, returndata, errorMessage);
      }
  
      /**
       * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
       * revert reason using the provided one.
       *
       * _Available since v4.3._
       */
      function verifyCallResult(
          bool success,
          bytes memory returndata,
          string memory errorMessage
      ) internal pure returns (bytes memory) {
          if (success) {
              return returndata;
          } else {
              // Look for revert reason and bubble it up if present
              if (returndata.length > 0) {
                  // The easiest way to bubble the revert reason is using memory via assembly
  
                  assembly {
                      let returndata_size := mload(returndata)
                      revert(add(32, returndata), returndata_size)
                  }
              } else {
                  revert(errorMessage);
              }
          }
      }
  }
  
  interface IERC20 {
      event Approval(
          address indexed owner,
          address indexed spender,
          uint256 value
      );
      event Transfer(address indexed from, address indexed to, uint256 value);
  
      function name() external view returns (string memory);
  
      function symbol() external view returns (string memory);
  
      function decimals() external view returns (uint8);
  
      function totalSupply() external view returns (uint256);
  
      function balanceOf(address owner) external view returns (uint256);
  
      function allowance(
          address owner,
          address spender
      ) external view returns (uint256);
  
      function approve(address spender, uint256 value) external returns (bool);
  
      function transfer(address to, uint256 value) external returns (bool);
  
      function transferFrom(
          address from,
          address to,
          uint256 value
      ) external returns (bool);
  }
  
  library SafeERC20 {
      using Address for address;
  
      function safeTransfer(IERC20 token, address to, uint256 value) internal {
          _callOptionalReturn(
              token,
              abi.encodeWithSelector(token.transfer.selector, to, value)
          );
      }
  
      function safeTransferFrom(
          IERC20 token,
          address from,
          address to,
          uint256 value
      ) internal {
          _callOptionalReturn(
              token,
              abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
          );
      }
  
      /**
       * @dev Deprecated. This function has issues similar to the ones found in
       * {IERC20-approve}, and its usage is discouraged.
       *
       * Whenever possible, use {safeIncreaseAllowance} and
       * {safeDecreaseAllowance} instead.
       */
      function safeApprove(
          IERC20 token,
          address spender,
          uint256 value
      ) internal {
          // safeApprove should only be called when setting an initial allowance,
          // or when resetting it to zero. To increase and decrease it, use
          // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
          require(
              (value == 0) || (token.allowance(address(this), spender) == 0),
              "SafeERC20: approve from non-zero to non-zero allowance"
          );
          _callOptionalReturn(
              token,
              abi.encodeWithSelector(token.approve.selector, spender, value)
          );
      }
  
      function safeIncreaseAllowance(
          IERC20 token,
          address spender,
          uint256 value
      ) internal {
          uint256 newAllowance = token.allowance(address(this), spender) + value;
          _callOptionalReturn(
              token,
              abi.encodeWithSelector(
                  token.approve.selector,
                  spender,
                  newAllowance
              )
          );
      }
  
      function safeDecreaseAllowance(
          IERC20 token,
          address spender,
          uint256 value
      ) internal {
          unchecked {
              uint256 oldAllowance = token.allowance(address(this), spender);
              require(
                  oldAllowance >= value,
                  "SafeERC20: decreased allowance below zero"
              );
              uint256 newAllowance = oldAllowance - value;
              _callOptionalReturn(
                  token,
                  abi.encodeWithSelector(
                      token.approve.selector,
                      spender,
                      newAllowance
                  )
              );
          }
      }
  
      /**
       * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
       * on the return value: the return value is optional (but if data is returned, it must not be false).
       * @param token The token targeted by the call.
       * @param data The call data (encoded using abi.encode or one of its variants).
       */
      function _callOptionalReturn(IERC20 token, bytes memory data) private {
          // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
          // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
          // the target address contains contract code and also asserts for success in the low-level call.
  
          bytes memory returndata = address(token).functionCall(
              data,
              "SafeERC20: low-level call failed"
          );
          if (returndata.length > 0) {
              // Return data is optional
              require(
                  abi.decode(returndata, (bool)),
                  "SafeERC20: ERC20 operation did not succeed"
              );
          }
      }
  }
  
  contract Ownable is Context {
      address private _owner;
  
      event OwnershipTransferred(
          address indexed previousOwner,
          address indexed newOwner
      );
  
      constructor() {
          address msgSender = _msgSender();
          _owner = msgSender;
          emit OwnershipTransferred(address(0), msgSender);
      }
  
      function owner() public view returns (address) {
          return _owner;
      }
  
      modifier onlyOwner() {
          require(_owner == _msgSender(), "Ownable: caller is not the owner");
          _;
      }
  
      function renounceOwnership() public onlyOwner {
          emit OwnershipTransferred(_owner, address(0));
          _owner = address(0);
      }
  
      function transferOwnership(address newOwner) public onlyOwner {
          _transferOwnership(newOwner);
      }
  
      function _transferOwnership(address newOwner) internal {
          require(
              newOwner != address(0),
              "Ownable: new owner is the zero address"
          );
          emit OwnershipTransferred(_owner, newOwner);
          _owner = newOwner;
      }
  }
  
  library SafeMath {
      function add(uint256 a, uint256 b) internal pure returns (uint256) {
          uint256 c = a + b;
          require(c >= a, "SafeMath: addition overflow");
  
          return c;
      }
  
      function sub(uint256 a, uint256 b) internal pure returns (uint256) {
          require(b <= a, "SafeMath: subtraction overflow");
          uint256 c = a - b;
  
          return c;
      }
  
      function mul(uint256 a, uint256 b) internal pure returns (uint256) {
          if (a == 0) {
              return 0;
          }
  
          uint256 c = a * b;
          require(c / a == b, "SafeMath: multiplication overflow");
  
          return c;
      }
  
      function div(uint256 a, uint256 b) internal pure returns (uint256) {
          require(b > 0, "SafeMath: division by zero");
          uint256 c = a / b;
  
          return c;
      }
  }
  
  contract Claimable is Ownable {
      function claimETH(uint256 amount) external onlyOwner {
          (bool sent, ) = owner().call{value: amount}("");
          require(sent, "Failed to send Ether");
      }
  }
  contract GuardAIPlinko is Claimable {
      using SafeMath for uint256;
      using SafeERC20 for IERC20;
  
      address playToken;
      uint256[] rows_8 = [160, 37, 15, 5, 3, 5, 15, 37, 160];
      uint256[] rows_12 = [220, 42, 30, 20, 14, 6, 3, 6, 14, 20, 30, 42, 220];
      uint256[] rows_16 = [
          250,
          96,
          63,
          40,
          19,
          17,
          14,
          5,
          2,
          5,
          14,
          17,
          19,
          40,
          63,
          96,
          250
      ];
  
      uint256 rows8Length = 9;
      uint256 rows12Length = 13;
      uint256 rows16Length = 17;
  
      mapping(address => uint256) public playerWinnings;
      mapping(address => uint256) private results;
  
      constructor() {}
  
      function isContract(address _address) private view returns (bool) {
          uint32 size;
          assembly {
              size := extcodesize(_address)
          }
          return (size > 0); //Warning: will return false if the call is made from the constructor of a smart contract
      }
  
      function setToken(address _tokenAddress) public onlyOwner {
          playToken = _tokenAddress;
      }
  
      function pseudoRandom() private view returns (uint) {
          return uint(keccak256(abi.encodePacked(block.timestamp, msg.sender)));
      }
  
      function pliko_play(uint256 rowCount) public payable {
          require(
              isContract(msg.sender) == false,
              "Msg.sender should be address. Not allowed contract"
          );
          uint256 randomValue = uint256(
              keccak256(abi.encodePacked(block.timestamp))
          ) % (rowCount + 1);
          uint256 profitResult = 0;
          if (rowCount == 8) {
              profitResult = rows_8[randomValue];
          } else if (rowCount == 12) {
              profitResult = rows_12[randomValue];
          } else {
              profitResult = rows_16[randomValue];
          }
          uint256 refundValue = (msg.value * profitResult) / 10;
          payable(msg.sender).transfer(refundValue);
          results[msg.sender] = randomValue;
      }
  
      function getWeightedRandomMultiplier(
          uint256 rowCount
      ) private view returns (uint) {
          uint totalInverse = 0;
          for (uint i = 0; i < rowCount; i++) {
              if (rowCount == 8) {
                  totalInverse += 1e18 / (rows_8[i]); // Use 1e18 for precision
              } else if (rowCount == 12) {
                  totalInverse += 1e18 / (rows_12[i]); // Use 1e18 for precision
              } else {
                  totalInverse += 1e18 / (rows_16[i]); // Use 1e18 for precision
              }
          }
  
          uint random = pseudoRandom() % totalInverse;
          uint sum = 0;
  
          for (uint i = 0; i < rowCount; i++) {
              if (rowCount == 8) {
                  sum += 1e18 / (rows_8[i]); // Use 1e18 for precision
                  if (random < sum) {
                      return i;
                  }
              } else if (rowCount == 12) {
                  sum += 1e18 / (rows_12[i]); // Use 1e18 for precision
                  if (random < sum) {
                      return i;
                  }
              } else {
                  sum += 1e18 / (rows_16[i]); // Use 1e18 for precision
                  if (random < sum) {
                      return i;
                  }
              }
          }
          // Fallback
          return 0;
      }
  
      function pliko_token_play(uint256 rowCount, uint256 amount) public {
          require(
              isContract(msg.sender) == false,
              "Msg.sender should be address. Not allowed contract"
          );
  
          IERC20(playToken).safeTransferFrom(msg.sender, address(this), amount);
  
          uint256 randomValue = getWeightedRandomMultiplier(rowCount);
          uint256 profitResult = 0;
          if (rowCount == 8) {
              profitResult = rows_8[randomValue];
          } else if (rowCount == 12) {
              profitResult = rows_12[randomValue];
          } else {
              profitResult = rows_16[randomValue];
          }
          uint256 refundValue = (amount * profitResult) / 10;
          playerWinnings[msg.sender] = SafeMath.add(
              playerWinnings[msg.sender],
              refundValue
          );
          results[msg.sender] = randomValue;
      }
  
      function getResult() public view returns (uint256) {
          return results[msg.sender];
      }
  
      function withdrawUserWinnings() public {
          require(playerWinnings[msg.sender] > 0, "No funds to withdraw");
          uint256 amount = playerWinnings[msg.sender];
          playerWinnings[msg.sender] = 0;
          IERC20(playToken).safeTransfer(msg.sender, amount);
      }
  
      function withdrawETHs() external onlyOwner {
          (bool success, ) = owner().call{value: address(this).balance}("");
          require(success, "Failed to withdraw");
      }
  
      function withdrawAllTokens(address token) public onlyOwner {
          uint256 amount = IERC20(token).balanceOf(address(this));
          IERC20(token).safeTransfer(msg.sender, amount);
      }
      receive() external payable {}
  
      fallback() external payable {}
  }