AdilScan
Blocks
Blocks
Uncles
Forked Blocks (Reorgs)
Transactions
Validated
Pending
Cancel transaction
Tokens
All
ADIL Addresses
APIs
GraphQL
RPC
Eth RPC
Apps
Faucet Testnet
Adil chain
Mainnets
Testnets
Other Networks
Validators
Validators
Punished Validators
Proposal
/
Search
/
Search
Connection Lost
New Vyper Smart Contract Verification
Contract Address
The 0x address supplied on contract creation.
Contract Name
Must match the name specified in the code.
Compiler
latest
v0.4.3rc1
v0.4.2rc1
v0.4.1rc3
v0.4.1rc2
v0.4.1rc1
v0.4.1b4
v0.4.1b3
v0.4.1b2
v0.4.1b1
v0.4.0rc6
v0.4.0rc5
v0.4.0rc4
v0.4.0rc3
v0.4.0rc2
v0.4.0rc1
v0.4.0b6
v0.4.0b5
v0.4.0b4
v0.4.0b3
v0.4.0b2
v0.4.0b1
v0.3.10rc5
v0.3.10rc4
v0.3.10rc3
v0.3.10rc2
v0.3.10
v0.4.3
v0.4.2
v0.4.1
v0.4.0
Enter the Vyper Contract Code
//SPDX-License-Identifier: MIT pragma solidity ^0.8.1; import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol"; contract Collection1155Proxy is OwnableUpgradeable, ERC1155Upgradeable, ERC1155URIStorageUpgradeable { address[] public earners; uint256[] public ratesEarning; mapping(address => bool) private operators; mapping(address => uint256) private checkDoubleAddr; mapping(uint256 => string) private _tokenURIs; string public baseURI; uint256 TOTAL_RATE; uint256 countTokenId; uint256 LENGTH_EARNER; mapping(uint256 => uint256) public tokenByIndex; mapping(uint256 => uint256) public getValueTokenId; event getEarning(address indexed from, address indexed to, address earner, uint256 rate); modifier operatorOrOwner() { require( operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner" ); _; } function initialize() public initializer { __ERC1155_init(""); __Ownable_init(); TOTAL_RATE = 10*10000; LENGTH_EARNER = 5; } function addOperator(address operator) external virtual onlyOwner { require( operator != address(0), "OwnerOperator: operator is the zero address" ); operators[operator] = true; } function removeOperator(address operator) external virtual onlyOwner { require( operator != address(0), "OwnerOperator: operator is the zero address" ); operators[operator] = false; } function mint( address account, uint256 id, uint256 amount, string memory metaUrl ) public operatorOrOwner { _mint(account, id, amount, "0x"); if(getValueTokenId[id] == 0) { tokenByIndex[countTokenId] = id; countTokenId += 1; } getValueTokenId[id] += amount; setURI(id, metaUrl); } function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, string[] memory metaUrls ) public operatorOrOwner { for (uint256 i = 0; i < ids.length; i++) { mint(to, ids[i], amounts[i], metaUrls[i]); } } function burn(address account, uint256 id, uint256 value) public { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burn(account, id, value); } function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) public { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, ids, values); } function setBaseURI(string memory _baseURI) public operatorOrOwner { baseURI = _baseURI; } function setURI(uint256 tokenId, string memory tokenURI) internal { _tokenURIs[tokenId] = tokenURI; emit URI(uri(tokenId), tokenId); } function uri( uint256 tokenId ) public view override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable) returns (string memory) { string memory tokenURI = _tokenURIs[tokenId]; return bytes(tokenURI).length > 0 ? string(abi.encodePacked(baseURI, tokenURI)) : super.uri(tokenId); } function restoreEarners(address[] memory _earners) private{ address[] memory earnersVal = new address[](_earners.length); earnersVal = _earners; for(uint256 i = 0; i < _earners.length; i++){ delete checkDoubleAddr[earnersVal[i]]; } } function setEarning( address[] memory _earners, uint256[] memory _rates ) public onlyOwner { require( _earners.length == _rates.length, "Length of earner and rates must be same" ); require(_earners.length <= LENGTH_EARNER, "Earner must be less than 5"); restoreEarners(_earners); address[] memory earnersVal = new address[](_earners.length); uint256[] memory ratesVal = new uint256[](_rates.length); earnersVal = _earners; ratesVal = _rates; uint256 totalRate; for (uint256 i = 0; i < ratesVal.length; i++) { totalRate += ratesVal[i]; require(checkDoubleAddr[earnersVal[i]] != 1, "Address duplicated"); checkDoubleAddr[earnersVal[i]] = 1; } require(totalRate <= TOTAL_RATE, "Total rate earning is excceed"); earners = _earners; ratesEarning = _rates; for(uint256 i = 0; i < earnersVal.length; i++){ emit getEarning(msg.sender, address(this), earnersVal[i], ratesVal[i]); } } function getEarnersAndRates() public view returns (address[] memory, uint256[] memory) { return (earners, ratesEarning); } function getLenEarnersAndRates() public view returns (uint256, uint256) { return (earners.length, ratesEarning.length); } function totalSupply() public view returns (uint256) { return countTokenId; } function supportsInterface( bytes4 interfaceId ) public view virtual override(ERC1155Upgradeable) returns (bool) { return interfaceId == type(IERC1155Upgradeable).interfaceId || super.supportsInterface(interfaceId); } }
ABI-encoded Constructor Arguments (if required by the contract)
Add arguments in
ABI hex encoded form
. Constructor arguments are written right to left, and will be found at the end of the input created bytecode. They may also be
parsed here.
Loading...
Verify & publish
Cancel
Ok
Ok
Ok
No
Yes