github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/contracts/statute/src/meshbox_0.0.2.sol (about) 1 pragma solidity >=0.5.0 <=0.5.3; 2 3 //import "github.com/SmartMeshFoundation/Spectrum/contracts/statute/src/owned.sol"; // for remix 4 5 import "./owned.sol"; 6 7 contract MeshBox_0_0_2 is Owned { 8 9 string vsn = "0.0.2"; 10 11 mapping(address => uint256) meshboxAddress; 12 13 address[] meshboxList; //0.0.2 14 15 // ["0xa9a461abfac6a9a058a6ef2198fd2780e7d4f7e2","0xa9a461abfac6a9a058a6ef2198fd2780e7d4f7e3","0xa9a461abfac6a9a058a6ef2198fd2780e7d4f7e4","0xa9a461abfac6a9a058a6ef2198fd2780e7d4f7e2","0xa9a461abfac6a9a058a6ef2198fd2780e7d4f7e5"],1 16 function addAddress(address[] memory _owners, uint weight) public onlyOwner() { 17 uint len = _owners.length; 18 for (uint i = 0; i < len; i ++) { 19 address _o = _owners[i]; 20 if (meshboxAddress[_o] == 0) { 21 meshboxList.push(_o); 22 } 23 meshboxAddress[_o] = weight; 24 } 25 } 26 27 //0.0.2 28 function cleanMeshboxList(address addr) private { 29 meshboxAddress[addr] = 0; 30 for (uint i=0;i<meshboxList.length;i++) { 31 if (meshboxList[i] == addr) { 32 for (uint j=i;j<meshboxList.length-1;j++) { 33 meshboxList[j] = meshboxList[j+1]; 34 } 35 i--; 36 meshboxList.length -= 1; 37 } 38 } 39 } 40 41 function delAddress(address[] memory _owners) public onlyOwner() { 42 uint len = _owners.length; 43 for (uint i = 0; i < len; i ++) { 44 cleanMeshboxList(_owners[i]); 45 } 46 } 47 48 function existAddress(address _owner) view public returns (uint256){ 49 return meshboxAddress[_owner]; 50 } 51 52 // vsn-0.0.2 >>>>> 53 function version() public view returns (string memory) {return vsn;} 54 function getMeshboxList() view public returns (address[] memory) {return meshboxList;} 55 // vsn-0.0.2 <<<<< 56 57 } 58