-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathW8day3n4.sol
More file actions
63 lines (45 loc) · 1.9 KB
/
W8day3n4.sol
File metadata and controls
63 lines (45 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
contract MultiOwner{
mapping (uint256 => mapping (address => uint256)) private balances;
address public owner;
event ownerState(address old, address newOwner);
constructor(){
owner = msg.sender;
}
function transferOwnership(address newOwner) public onlyOwner{
owner = newOwner;
emit ownerState(msg.sender, newOwner);
}
function renounceOwnership() public onlyOwner{
owner = address(0);
emit ownerState(msg.sender, address(0));
}
error exploiter();
modifier onlyOwner(){
require(msg.sender == owner, exploiter());
_;
}
//core functions
function balanceOf(address account, uint256 id) public view returns(uint256){
return balances[id][account];
}
function balanceofBatch(address[] memory accounts, uint256[] memory ids) public view returns(uint256[] memory){
//return balances[ids[]][accounts[]];
}
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) public view onlyOwner{}
//ERC1155 events
event TransferSingle(address operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(address operator, address indexed from, address indexed to, uint256[] id, uint256[] value);
function mintSingle(address to, uint256 id, uint256 amount) public onlyOwner {
balances[id][to] += amount;
emit TransferSingle(msg.sender, address(0), to, id, amount);
}
function mintBatch(address to, uint256[] memory id, uint256[] memory amount) public onlyOwner {
uint256 ids = id.length;
for(uint256 i = 0; i < ids; i++){
balances[id[i]][to] += amount[i];
emit TransferBatch(msg.sender, address(0), to, id, amount);
}
}
}