Fix totalSupply in ERC-1155
This commit is contained in:
parent
b833e9602c
commit
2a012070a8
|
@ -2,11 +2,11 @@
|
|||
pragma solidity ^0.8.7;
|
||||
|
||||
import "@openzeppelin/contracts@4.5.0/access/AccessControlEnumerable.sol";
|
||||
import "@openzeppelin/contracts@4.5.0/token/ERC1155/ERC1155.sol";
|
||||
import "@openzeppelin/contracts@4.5.0/token/ERC1155/extensions/ERC1155Supply.sol";
|
||||
import "@openzeppelin/contracts@4.5.0/utils/Context.sol";
|
||||
import "@openzeppelin/contracts@4.5.0/utils/Counters.sol";
|
||||
|
||||
contract Erc1155Faucet is Context, AccessControlEnumerable, ERC1155 {
|
||||
contract Erc1155Faucet is Context, AccessControlEnumerable, ERC1155Supply {
|
||||
string internal nftName;
|
||||
string internal nftSymbol;
|
||||
|
||||
|
@ -69,4 +69,20 @@ contract Erc1155Faucet is Context, AccessControlEnumerable, ERC1155 {
|
|||
{
|
||||
return ERC1155.supportsInterface(interfaceId) || AccessControlEnumerable.supportsInterface(interfaceId);
|
||||
}
|
||||
|
||||
function totalSupply()
|
||||
public
|
||||
view
|
||||
returns (uint256)
|
||||
{
|
||||
uint256 result = 0;
|
||||
uint256 maxId = _tokenIdCounter.current();
|
||||
|
||||
for(uint256 i = 0; i < maxId; i++)
|
||||
{
|
||||
result = result + totalSupply(i);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
{
|
||||
"Id": "Ropsten",
|
||||
"Erc721ContractAddress": "0x71902F99902339d7ce1F994C12155f4350BCD226",
|
||||
"Erc1155ContractAddress": "0x6c0449f3B8135f896637afd29c7aeA496ED6f4F3"
|
||||
"Erc1155ContractAddress": "0x80b45421881c0452A6e70148Fc928fA33107cEb3"
|
||||
},
|
||||
{
|
||||
"Id": "PolygonMumbai",
|
||||
"Erc721ContractAddress": "0xeE8272220A0988279627714144Ff6981E204fbE4",
|
||||
"Erc1155ContractAddress": "0x2E6C3fa7B2Ed656e695A29276a22c8C33d118a1B"
|
||||
"Erc1155ContractAddress": "0x23147CdbD963A3D0fec0F25E4604844f477F65d2"
|
||||
}
|
||||
],
|
||||
"IpfsGateways": [
|
||||
|
|
|
@ -18,8 +18,8 @@ Used [contracts](NftFaucet/Contracts) are based on [OpenZeppilin contracts](http
|
|||
|
||||
| | ERC-721 | ERC-1155 |
|
||||
|----------------|-----------|------------|
|
||||
| Ropsten | [0x71902F99902339d7ce1F994C12155f4350BCD226](https://ropsten.etherscan.io/token/0x71902F99902339d7ce1F994C12155f4350BCD226) | [0x6c0449f3B8135f896637afd29c7aeA496ED6f4F3](https://ropsten.etherscan.io/token/0x6c0449f3B8135f896637afd29c7aeA496ED6f4F3) |
|
||||
| Polygon Mumbai | [0xeE8272220A0988279627714144Ff6981E204fbE4](https://mumbai.polygonscan.com/token/0xeE8272220A0988279627714144Ff6981E204fbE4) | [0x2E6C3fa7B2Ed656e695A29276a22c8C33d118a1B](https://mumbai.polygonscan.com/token/0x2E6C3fa7B2Ed656e695A29276a22c8C33d118a1B) |
|
||||
| Ropsten | [0x71902F99902339d7ce1F994C12155f4350BCD226](https://ropsten.etherscan.io/token/0x71902F99902339d7ce1F994C12155f4350BCD226) | [0x80b45421881c0452A6e70148Fc928fA33107cEb3](https://ropsten.etherscan.io/token/0x80b45421881c0452A6e70148Fc928fA33107cEb3) |
|
||||
| Polygon Mumbai | [0xeE8272220A0988279627714144Ff6981E204fbE4](https://mumbai.polygonscan.com/token/0xeE8272220A0988279627714144Ff6981E204fbE4) | [0x23147CdbD963A3D0fec0F25E4604844f477F65d2](https://mumbai.polygonscan.com/token/0x23147CdbD963A3D0fec0F25E4604844f477F65d2) |
|
||||
|
||||
## Technology stack
|
||||
|
||||
|
|
Loading…
Reference in New Issue