Contracts
Last updated
Last updated
Returns the contract Application Binary Interface ( ABI ) of a verified smart contract.
Find verified contracts on our Verified Contracts Source Code page.
https://api-testnet.bttcscan.com/api
?module=contract
&action=getabi
&address=0xa8bD4d0623626c0C31653765704DeD33533Ed35c
&apikey=YourApiKeyToken
Try this endpoint in your browser
Query Parameters
address
the contract address
that has a verified source code
Sample Response
{
"status":"1",
"message":"OK",
"result":"[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"Donate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_burnAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"SetBurnAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"SetDenominatorAndNumerator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetTokenLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_streamerAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"setWhiteListEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string[]\",\"name\":\"t0\",\"type\":\"string[]\"}],\"name\":\"test0\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"t1\",\"type\":\"string\"}],\"name\":\"test1\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"t2\",\"type\":\"address\"}],\"name\":\"test2\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"t3\",\"type\":\"address\"}],\"name\":\"test3\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t4\",\"type\":\"uint256\"}],\"name\":\"test4\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t5\",\"type\":\"uint256\"}],\"name\":\"test5\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NUM\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SECONDS_IN_DAY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRX\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_burnRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_streamerIds\",\"type\":\"string[]\"},{\"internalType\":\"address[]\",\"name\":\"_streamerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_tokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"batchWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"burnAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"burnBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"donate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"genesisTs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_tokenAddress\",\"type\":\"address[]\"}],\"name\":\"getAllBalance\",\"outputs\":[{\"internalType\":\"uint256[3]\",\"name\":\"\",\"type\":\"uint256[3]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBurnAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDenominatorAndNumerator\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"}],\"internalType\":\"struct Donation.burnRatio\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getStreamerBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getTokenLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getViewerDonation\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"}],\"name\":\"getWhiteList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initGenesis\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initianizeGenesis\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_burnAddr\",\"type\":\"address\"}],\"name\":\"setBurnAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"}],\"name\":\"setDenominatorAndNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setTokenLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"setWhiteList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whiteList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_streamerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrawLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]"
}
A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contract.
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider());
var version = web3.version.api;
$.getJSON('https://api-testnet.bttcscan.com/api?module=contract&action=getabi&address=0x0000000000000000000000000000000000001004&apikey=YourApiKeyToken', function (data) {
var contractABI = "";
contractABI = JSON.parse(data.result);
if (contractABI != '') {
var MyContract = web3.eth.contract(contractABI);
var myContractInstance = MyContract.at("0xa8bD4d0623626c0C31653765704DeD33533Ed35c");
var result = myContractInstance.memberId("0xfe8ad7dd2f564a877cc23feea6c0a9cc2e783715");
console.log("result1 : " + result);
var result = myContractInstance.members(1);
console.log("result2 : " + result);
} else {
console.log("Error");
}
});
Returns the Solidity source code of a verified smart contract.
https://api-testnet.bttcscan.com/api
?module=contract
&action=getsourcecode
&address=0xa8bD4d0623626c0C31653765704DeD33533Ed35c
&apikey=YourApiKeyToken
Query Parameters
address
the contract address
that has a verified source code
Sample Response
{
"status":"1",
"message":"OK",
"result":[
{
"SourceCode":"{{\r\n \"language\": \"Solidity\",\r\n \"sources\": {\r\n \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal initializer {\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal initializer {\\n address msgSender = _msgSender();\\n _owner = msgSender;\\n emit OwnershipTransferred(address(0), msgSender);\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n _;\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n emit OwnershipTransferred(_owner, address(0));\\n _owner = address(0);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n emit OwnershipTransferred(_owner, newOwner);\\n _owner = newOwner;\\n }\\n uint256[49] private __gap;\\n}\\n\"\r\n },\r\n \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\n// solhint-disable-next-line compiler-version\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n */\\nabstract contract Initializable {\\n\\n /**\\n * @dev Indicates that the contract has been initialized.\\n */\\n bool private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Modifier to protect an initializer function from being invoked twice.\\n */\\n modifier initializer() {\\n require(_initializing || !_initialized, \\\"Initializable: contract is already initialized\\\");\\n\\n bool isTopLevelCall = !_initializing;\\n if (isTopLevelCall) {\\n _initializing = true;\\n _initialized = true;\\n }\\n\\n _;\\n\\n if (isTopLevelCall) {\\n _initializing = false;\\n }\\n }\\n}\\n\"\r\n },\r\n \"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuardUpgradeable is Initializable {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n function __ReentrancyGuard_init() internal initializer {\\n __ReentrancyGuard_init_unchained();\\n }\\n\\n function __ReentrancyGuard_init_unchained() internal initializer {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and make it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n uint256[49] private __gap;\\n}\\n\"\r\n },\r\n \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize, which returns 0 for contracts in\\n // construction, since the code is only stored at the end of the\\n // constructor execution.\\n\\n uint256 size;\\n // solhint-disable-next-line no-inline-assembly\\n assembly { size := extcodesize(account) }\\n return size > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\\n (bool success, ) = recipient.call{ value: amount }(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain`call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return _verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n\\n // solhint-disable-next-line no-inline-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\"\r\n },\r\n \"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/*\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal initializer {\\n __Context_init_unchained();\\n }\\n\\n function __Context_init_unchained() internal initializer {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691\\n return msg.data;\\n }\\n uint256[50] private __gap;\\n}\\n\"\r\n },\r\n \"@openzeppelin/contracts/token/ERC20/IERC20.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\"\r\n },\r\n \"contracts/Donation.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\ncontract Donation is OwnableUpgradeable, ReentrancyGuardUpgradeable {\\n\\n address public TRX;\\n address public burnAddress;\\n uint public constant NUM = 3;\\n\\n struct StreamerBalance {\\n //viewer_id => token address => token amount\\n mapping( string => mapping( address => uint )) viewer_amount;\\n //token address => token amount\\n mapping( address => uint ) streamer_amount;\\n }\\n struct burnRatio {\\n uint256 denominator;\\n uint256 numerator;\\n }\\n\\n //streamer id => streamerBalance\\n mapping( string => StreamerBalance ) streamer;\\n mapping( address => bool ) public whiteList;\\n burnRatio public _burnRatio;\\n uint256 public genesisTs;\\n uint256 public constant SECONDS_IN_DAY = 3_600 * 24;\\n bool public initGenesis;\\n //day->WL->token->amount\\n mapping(uint256=>mapping(address=>mapping(address=>uint256))) public withdrawLimit;\\n //token->amount\\n mapping(address=>uint256) public tokenLimit;\\n //token address => token amount\\n mapping( address => uint256 ) public burnBalance;\\n\\n event Burn(address _tokenAddress,uint256 _amount,address indexed _caller);\\n\\n event SetTokenLimit(address tokenAddress, uint256 amount);\\n\\n\\n event Donate(address _tokenAddress, uint256 _amount, string _viewerId, string _streamerId, address indexed _caller);\\n event Withdraw(address _tokenAddress,uint256 _amount,address _streamerAddress,string _streamerId);\\n event setWhiteListEvent(address wl, bool state);\\n event SetBurnAddress(address _burnAddress, address indexed _caller);\\n event SetDenominatorAndNumerator(uint256 _denominator, uint256 _numerator, address indexed _caller);\\n\\n event test0(string[] t0);\\n event test1(string t1);\\n event test2(address t2);\\n event test3(address t3);\\n event test4(uint t4);\\n event test5(uint t5);\\n\\n modifier onlyWhiteList {\\n require(whiteList[msg.sender] == true || owner() == msg.sender, \\\"only whitelist user can call\\\");\\n _;\\n }\\n\\n function initialize() public virtual initializer {\\n TRX = address(0);\\n burnAddress = 0x000000000000000000000000000000000000dEaD;\\n __Context_init_unchained();\\n __Ownable_init_unchained();\\n }\\n\\n\\n function initianizeGenesis() public virtual onlyOwner {\\n require(!initGenesis,\\\"Have already initialize genesis!\\\");\\n initGenesis = true;\\n genesisTs = block.timestamp;\\n }\\n\\n function donate(\\n string memory _viewerId,\\n string memory _streamerId,\\n address _tokenAddress, \\n uint _amount\\n ) external\\n payable\\n virtual\\n nonReentrant \\n {\\n require(bytes(_viewerId).length > 0,\\\"viewer id cannot be null\\\");\\n require(bytes(_streamerId).length > 0,\\\"streamer id cannot be null\\\");\\n require(_amount>0,\\\"invalid donation amount\\\");\\n uint256 burnAmount = _amount / _burnRatio.denominator * _burnRatio.numerator;\\n uint256 donationAmount = _amount - burnAmount;\\n if(_tokenAddress == address(0)){\\n require(_amount<=msg.value,\\\"Do not have enough TRX to donate\\\");\\n }\\n else{\\n IERC20 token = IERC20(_tokenAddress);\\n uint256 balance = token.balanceOf(_msgSender());\\n require(_amount<=balance,\\\"Do not have enough token to donate\\\");\\n token.transferFrom(_msgSender(), address(this), _amount);\\n }\\n burnBalance[_tokenAddress] += burnAmount;\\n streamer[_streamerId].streamer_amount[_tokenAddress] += donationAmount;\\n streamer[_streamerId].viewer_amount[_viewerId][_tokenAddress] += donationAmount;\\n emit Donate(_tokenAddress,donationAmount,_viewerId,_streamerId,_msgSender());\\n }\\n\\n function withdraw(\\n string memory _streamerId,\\n address _streamerAddress,\\n address _tokenAddress,\\n uint _amount\\n ) external\\n virtual\\n onlyWhiteList\\n {\\n\\n emit test1(_streamerId);\\n emit test2(_streamerAddress);\\n emit test3(_tokenAddress);\\n emit test4(_amount);\\n emit test5(streamer[_streamerId].streamer_amount[_tokenAddress]);\\n\\n require(_amount<=streamer[_streamerId].streamer_amount[_tokenAddress],\\\"Do not have enough token to withdraw\\\");\\n uint256 round = (block.timestamp - genesisTs) / SECONDS_IN_DAY;\\n uint256 limit = withdrawLimit[round][msg.sender][_tokenAddress] + _amount;\\n require(limit<=tokenLimit[_tokenAddress],\\\"Withdraw amount exceeds maximum amount!\\\");\\n withdrawLimit[round][msg.sender][_tokenAddress] += _amount;\\n streamer[_streamerId].streamer_amount[_tokenAddress] -= _amount;\\n if(_tokenAddress==address(0)){\\n payable(_streamerAddress).transfer(_amount);\\n }\\n else{\\n IERC20 token = IERC20(_tokenAddress);\\n token.transfer(_streamerAddress, _amount);\\n }\\n emit Withdraw(_tokenAddress, _amount, _streamerAddress,_streamerId);\\n }\\n\\n function batchWithdraw(\\n string[] memory _streamerIds,\\n address[] memory _streamerAddresses,\\n address[] memory _tokenAddresses,\\n uint[] memory _amounts\\n) external \\n virtual \\n onlyWhiteList {\\n uint256 maxLength = 100; // Maximum number of withdrawals in a batch\\n require(_streamerIds.length <= maxLength, \\\"Too many withdrawals in a batch\\\");\\n require(_streamerIds.length == _streamerAddresses.length, \\\"Mismatched array lengths\\\");\\n require(_streamerIds.length == _tokenAddresses.length, \\\"Mismatched array lengths\\\");\\n require(_streamerIds.length == _amounts.length, \\\"Mismatched array lengths\\\");\\n\\n for (uint i = 0; i < _streamerIds.length; i++) {\\n string memory _streamerId = _streamerIds[i];\\n address _streamerAddress = _streamerAddresses[i];\\n address _tokenAddress = _tokenAddresses[i];\\n uint _amount = _amounts[i];\\n\\n emit test1(_streamerId);\\n emit test2(_streamerAddress);\\n emit test3(_tokenAddress);\\n emit test4(_amount);\\n emit test5(streamer[_streamerId].streamer_amount[_tokenAddress]);\\n\\n require(_amount <= streamer[_streamerId].streamer_amount[_tokenAddress], \\\"Do not have enough token to withdraw\\\");\\n uint256 round = (block.timestamp - genesisTs) / SECONDS_IN_DAY;\\n uint256 limit = withdrawLimit[round][msg.sender][_tokenAddress] + _amount;\\n require(limit <= tokenLimit[_tokenAddress], \\\"Withdraw amount exceeds maximum amount!\\\");\\n\\n withdrawLimit[round][msg.sender][_tokenAddress] += _amount;\\n streamer[_streamerId].streamer_amount[_tokenAddress] -= _amount;\\n\\n if(_tokenAddress == address(0)) {\\n payable(_streamerAddress).transfer(_amount);\\n } else {\\n IERC20 token = IERC20(_tokenAddress);\\n token.transfer(_streamerAddress, _amount);\\n }\\n\\n emit Withdraw(_tokenAddress, _amount, _streamerAddress, _streamerId);\\n }\\n}\\n\\n function burn(\\n address _tokenAddress, \\n uint256 _amount\\n ) external \\n virtual\\n onlyOwner \\n {\\n require(_amount<=burnBalance[_tokenAddress],\\\"Burning too much\\\");\\n if(_tokenAddress == address(0)){\\n payable(burnAddress).transfer(_amount);\\n }\\n else{\\n IERC20 token = IERC20(_tokenAddress);\\n token.transfer(burnAddress, _amount);\\n }\\n burnBalance[_tokenAddress] -= _amount;\\n emit Burn(_tokenAddress, _amount, _msgSender());\\n }\\n\\n function setWhiteList(address wl, bool state) virtual external onlyOwner {\\n whiteList[wl] = state;\\n emit setWhiteListEvent(wl, state);\\n }\\n\\n function getWhiteList(address wl) public view returns(bool){\\n return whiteList[wl];\\n }\\n\\n function setBurnAddress(address _burnAddr) external virtual onlyOwner {\\n require(burnAddress!=_burnAddr,\\\"You need to pass a different address\\\");\\n burnAddress = _burnAddr;\\n emit SetBurnAddress(_burnAddr, _msgSender());\\n }\\n\\n function getBurnAddress() public view returns(address) {\\n return burnAddress;\\n }\\n\\n function setDenominatorAndNumerator\\n (\\n uint256 _denominator, \\n uint256 _numerator\\n ) external\\n virtual\\n onlyOwner \\n {\\n _burnRatio.denominator = _denominator;\\n _burnRatio.numerator = _numerator;\\n emit SetDenominatorAndNumerator(_denominator,_numerator,_msgSender());\\n }\\n\\n function getDenominatorAndNumerator()\\n public \\n view\\n returns(\\n burnRatio memory\\n ) \\n {\\n return _burnRatio;\\n }\\n\\n function getAllBalance(\\n string memory _streamerId,\\n address[] calldata _tokenAddress\\n )\\n public\\n view\\n returns(\\n uint[NUM] memory\\n )\\n {\\n uint[NUM] memory amount;\\n for(uint i=0; i<_tokenAddress.length; i++){\\n amount[i]=streamer[_streamerId].streamer_amount[_tokenAddress[i]];\\n }\\n return amount;\\n }\\n\\n function getStreamerBalance(\\n string memory _streamerId,\\n address _tokenAddress\\n )\\n public\\n view\\n returns(\\n uint \\n )\\n {\\n return streamer[_streamerId].streamer_amount[_tokenAddress];\\n }\\n\\n function getViewerDonation(\\n string memory _viewerId,\\n string memory _streamerId,\\n address _tokenAddress\\n )\\n public\\n view\\n returns(\\n uint\\n )\\n {\\n return streamer[_streamerId].viewer_amount[_viewerId][_tokenAddress];\\n }\\n\\n function setTokenLimit(address _tokenAddress, uint256 _amount) virtual external onlyOwner {\\n tokenLimit[_tokenAddress] = _amount;\\n emit SetTokenLimit(_tokenAddress,_amount);\\n }\\n\\n function getTokenLimit(address _tokenAddress) public view returns(uint256) {\\n return tokenLimit[_tokenAddress];\\n }\\n\\n receive() external payable {}\\n\\n}\"\r\n }\r\n },\r\n \"settings\": {\r\n \"optimizer\": {\r\n \"enabled\": false,\r\n \"runs\": 200\r\n },\r\n \"outputSelection\": {\r\n \"*\": {\r\n \"*\": [\r\n \"evm.bytecode\",\r\n \"evm.deployedBytecode\",\r\n \"devdoc\",\r\n \"userdoc\",\r\n \"metadata\",\r\n \"abi\"\r\n ]\r\n }\r\n },\r\n \"libraries\": {}\r\n }\r\n}}",
"ABI":"[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"Donate\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_burnAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"SetBurnAddress\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_caller\",\"type\":\"address\"}],\"name\":\"SetDenominatorAndNumerator\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"SetTokenLimit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_streamerAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"}],\"name\":\"Withdraw\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"setWhiteListEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string[]\",\"name\":\"t0\",\"type\":\"string[]\"}],\"name\":\"test0\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"t1\",\"type\":\"string\"}],\"name\":\"test1\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"t2\",\"type\":\"address\"}],\"name\":\"test2\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"t3\",\"type\":\"address\"}],\"name\":\"test3\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t4\",\"type\":\"uint256\"}],\"name\":\"test4\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"t5\",\"type\":\"uint256\"}],\"name\":\"test5\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"NUM\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SECONDS_IN_DAY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"TRX\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_burnRatio\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string[]\",\"name\":\"_streamerIds\",\"type\":\"string[]\"},{\"internalType\":\"address[]\",\"name\":\"_streamerAddresses\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_tokenAddresses\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"batchWithdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"burnAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"burnBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"donate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"genesisTs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address[]\",\"name\":\"_tokenAddress\",\"type\":\"address[]\"}],\"name\":\"getAllBalance\",\"outputs\":[{\"internalType\":\"uint256[3]\",\"name\":\"\",\"type\":\"uint256[3]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBurnAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDenominatorAndNumerator\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"}],\"internalType\":\"struct Donation.burnRatio\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getStreamerBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getTokenLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_viewerId\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"}],\"name\":\"getViewerDonation\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"}],\"name\":\"getWhiteList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initGenesis\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initianizeGenesis\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_burnAddr\",\"type\":\"address\"}],\"name\":\"setBurnAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"}],\"name\":\"setDenominatorAndNumerator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setTokenLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wl\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"state\",\"type\":\"bool\"}],\"name\":\"setWhiteList\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"whiteList\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_streamerId\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_streamerAddress\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_tokenAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"withdraw\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"withdrawLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]",
"ContractName":"Donation",
"CompilerVersion":"v0.8.9+commit.e5eed63a",
"OptimizationUsed":"0",
"Runs":"200",
"ConstructorArguments":"",
"EVMVersion":"Default",
"Library":"",
"LicenseType":"",
"Proxy":"0",
"Implementation":"",
"SwarmSource":""
}
]
}
Submits a contract source code to BTTCScan for verification.
Requires a valid BTTCScan API key, it will be rejected otherwise
Only supports HTTP POST due to max transfer size limitations for HTTP GET
Supports up to 10 different library pairs
Contracts that use "imports" will need to have the code concatenated into one file as we do not support "imports" in separate files.
List of supported solc versions, only solc version v0.4.11 and above is supported e.g. v0.4.25+commit.59dbf8f1
Upon successful submission you will receive a GUID (50 characters) as a receipt
You may use this GUID to track the status of your submission
Verified Source Codes will be displayed at the Verified Contracts page.
//Submit Source Code for Verification
$.ajax({
type: "POST", //Only POST supported
url: "//api-testnet.bttcscan.com/api", //Set to the correct API url for Other Networks
data: {
apikey: $('#apikey').val(), //A valid API-Key is required
module: 'contract', //Do not change
action: 'verifysourcecode', //Do not change
contractaddress: $('#contractaddress').val(), //Contract Address starts with 0x...
sourceCode: $('#sourceCode').val(), //Contract Source Code (Flattened if necessary)
codeformat: $('#codeformat').val(), //solidity-single-file (default) or solidity-standard-json-input (for std-input-json-format support
contractname: $('#contractname').val(), //ContractName (if codeformat=solidity-standard-json-input, then enter contractname as ex: erc20.sol:erc20)
compilerversion: $('#compilerversion').val(), // see https://bttcscan.com/solcversions for list of support versions
optimizationUsed: $('#optimizationUsed').val(), //0 = No Optimization, 1 = Optimization used (applicable when codeformat=solidity-single-file)
runs: 200, //set to 200 as default unless otherwise (applicable when codeformat=solidity-single-file)
constructorArguements: $('#constructorArguements').val(), //if applicable
evmversion: $('#evmVersion').val(), //leave blank for compiler default, homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul (applicable when codeformat=solidity-single-file)
licenseType: $('#licenseType').val(), //Valid codes 1-12 where 1=No License .. 12=Apache 2.0, see https://bttcscan.com/contract-license-types
libraryname1: $('#libraryname1').val(), //if applicable, a matching pair with libraryaddress1 required
libraryaddress1: $('#libraryaddress1').val(), //if applicable, a matching pair with libraryname1 required
libraryname2: $('#libraryname2').val(), //if applicable, matching pair required
libraryaddress2: $('#libraryaddress2').val(), //if applicable, matching pair required
libraryname3: $('#libraryname3').val(), //if applicable, matching pair required
libraryaddress3: $('#libraryaddress3').val(), //if applicable, matching pair required
libraryname4: $('#libraryname4').val(), //if applicable, matching pair required
libraryaddress4: $('#libraryaddress4').val(), //if applicable, matching pair required
libraryname5: $('#libraryname5').val(), //if applicable, matching pair required
libraryaddress5: $('#libraryaddress5').val(), //if applicable, matching pair required
libraryname6: $('#libraryname6').val(), //if applicable, matching pair required
libraryaddress6: $('#libraryaddress6').val(), //if applicable, matching pair required
libraryname7: $('#libraryname7').val(), //if applicable, matching pair required
libraryaddress7: $('#libraryaddress7').val(), //if applicable, matching pair required
libraryname8: $('#libraryname8').val(), //if applicable, matching pair required
libraryaddress8: $('#libraryaddress8').val(), //if applicable, matching pair required
libraryname9: $('#libraryname9').val(), //if applicable, matching pair required
libraryaddress9: $('#libraryaddress9').val(), //if applicable, matching pair required
libraryname10: $('#libraryname10').val(), //if applicable, matching pair required
libraryaddress10: $('#libraryaddress10').val() //if applicable, matching pair required
},
success: function (result) {
console.log(result);
if (result.status == "1") {
//1 = submission success, use the guid returned (result.result) to check the status of your submission.
// Average time of processing is 30-60 seconds
document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
// result.result is the GUID receipt for the submission, you can use this guid for checking the verification status
} else {
//0 = error
document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
}
console.log("status : " + result.status);
console.log("result : " + result.result);
},
error: function (result) {
console.log("error!");
document.getElementById("postresult").innerHTML = "Unexpected Error"
}
});
//Check Source Code Verification Status
$.ajax({
type: "GET",
url: "//api-testnet.bttcscan.com/api",
data: {
apikey: $('#apikey').val(),
guid: 'ezq878u486pzijkvvmerl6a9mzwhv6sefgvqi5tkwceejc7tvn', //Replace with your Source Code GUID receipt above
module: "contract",
action: "checkverifystatus"
},
success: function (result) {
console.log("status : " + result.status); //0=Error, 1=Pass
console.log("message : " + result.message); //OK, NOTOK
console.log("result : " + result.result); //result explanation
$('#guidstatus').html(">> " + result.result);
},
error: function (result) {
alert('error');
}
});
Submits a proxy contract source code to Etherscan for verification.
Requires a valid BTTCScan API key, it will be rejected otherwise
Current daily limit of 100 submissions per day per user (subject to change)
Only supports HTTP post
Upon successful submission you will receive a GUID (50 characters) as a receipt
You may use this GUID to track the status of your submission
Verified proxy contracts will display the "Read/Write as Proxy" of the implementation contract under the contract address's contract tab
// example with only the mandatory contract address parameter
curl -d "address=0xcbdcd3815b5f975e1a2c944a9b2cd1c985a1cb7f" "https://api-testnet.bttcscan.com/api?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"
// example using the expectedimplementation optional parameter
// the expectedimplementation enforces a check to ensure the returned implementation contract address == address picked up by the verifier
curl -d "address=0xbc46363a7669f6e12353fa95bb067aead3675c29&expectedimplementation=0xe45a5176bc0f2c1198e2451c4e4501d4ed9b65a6" "https://api-testnet.bttcscan.com/api?module=contract&action=verifyproxycontract&apikey=YourApiKeyToken"
// OK
{"status":"1","message":"OK","result":"gwgrrnfy56zf6vc1fljuejwg6pelnc5yns6fg6y2i6zfpgzquz"}
// NOTOK
{"status":"0","message":"NOTOK","result":"Invalid API Key"}
curl "https://api-testnet.bttcscan.com/api?module=contract&action=checkproxyverification&guid=gwgrrnfy56zf6vc1fljuejwg6pelnc5yns6fg6y2i6zfpgzquz&apikey=YourApiKeyToken"
// OK
{"status":"1","message":"OK","result":"The proxy's (0xbc46363a7669f6e12353fa95bb067aead3675c29) implementation contract is found at 0xe45a5176bc0f2c1198e2451c4e4501d4ed9b65a6 and is successfully updated."}
// NOTOK
{"status":"0","message":"NOTOK","result":"A corresponding implementation contract was unfortunately not detected for the proxy address."}
Tip : You can also download a CSV list of verified contracts addresses of which the code publishers have provided a corresponding Open Source license for redistribution.
Try this endpoint in your browser
Note : This endpoint is limited to 100 verifications/day, regardless of API PRO tier.
Note: Upon successful submission, a GUID is returned, which can be used to check for submission status.