@@ -911,7 +911,7 @@ contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {
911
911
912
912
}
913
913
914
- // File: contracts/helpers/MultiOwnable .sol
914
+ // File: zeppelin-solidity/ contracts/ownership/Ownable .sol
915
915
916
916
pragma solidity ^ 0.4.24 ;
917
917
@@ -921,8 +921,8 @@ pragma solidity ^0.4.24;
921
921
* @dev The Ownable contract has an owner address, and provides basic authorization control
922
922
* functions, this simplifies the implementation of "user permissions".
923
923
*/
924
- contract MultiOwnable {
925
- mapping ( address => bool ) public owners ;
924
+ contract Ownable {
925
+ address public owner ;
926
926
927
927
928
928
event OwnershipRenounced (address indexed previousOwner );
@@ -937,30 +937,26 @@ contract MultiOwnable {
937
937
* account.
938
938
*/
939
939
constructor () public {
940
- owners[ msg . sender ] = true ;
940
+ owner = msg . sender ;
941
941
}
942
942
943
943
/**
944
944
* @dev Throws if called by any account other than the owner.
945
945
*/
946
946
modifier onlyOwner () {
947
- require (owners[ msg .sender ] );
947
+ require (msg .sender == owner );
948
948
_;
949
949
}
950
950
951
- function isOwner (address _isOwner ) public view returns (bool ) {
952
- return owners[_isOwner];
953
- }
954
-
955
951
/**
956
952
* @dev Allows the current owner to relinquish control of the contract.
957
953
* @notice Renouncing to ownership will leave the contract without an owner.
958
954
* It will not be possible to call the functions with the `onlyOwner`
959
955
* modifier anymore.
960
956
*/
961
- function renounceOwnership (address _previousOwner ) public onlyOwner {
962
- emit OwnershipRenounced (_previousOwner );
963
- owners[_previousOwner] = false ;
957
+ function renounceOwnership () public onlyOwner {
958
+ emit OwnershipRenounced (owner );
959
+ owner = address ( 0 ) ;
964
960
}
965
961
966
962
/**
@@ -977,8 +973,79 @@ contract MultiOwnable {
977
973
*/
978
974
function _transferOwnership (address _newOwner ) internal {
979
975
require (_newOwner != address (0 ));
980
- emit OwnershipTransferred (msg .sender , _newOwner);
981
- owners[_newOwner] = true ;
976
+ emit OwnershipTransferred (owner, _newOwner);
977
+ owner = _newOwner;
978
+ }
979
+ }
980
+
981
+ // File: contracts/helpers/Admin.sol
982
+
983
+ pragma solidity ^ 0.4.24 ;
984
+
985
+
986
+ /**
987
+ * @title Ownable
988
+ * @dev The Ownable contract has an admin address, and provides basic authorization control
989
+ * functions, this simplifies the implementation of "user permissions".
990
+ */
991
+ contract Admin {
992
+ mapping (address => bool ) public admins;
993
+
994
+
995
+ event AdminshipRenounced (address indexed previousAdmin );
996
+ event AdminshipTransferred (
997
+ address indexed previousAdmin ,
998
+ address indexed newAdmin
999
+ );
1000
+
1001
+
1002
+ /**
1003
+ * @dev The Ownable constructor sets the original `admin` of the contract to the sender
1004
+ * account.
1005
+ */
1006
+ constructor () public {
1007
+ admins[msg .sender ] = true ;
1008
+ }
1009
+
1010
+ /**
1011
+ * @dev Throws if called by any account other than the admin.
1012
+ */
1013
+ modifier onlyAdmin () {
1014
+ require (admins[msg .sender ]);
1015
+ _;
1016
+ }
1017
+
1018
+ function isAdmin (address _admin ) public view returns (bool ) {
1019
+ return admins[_admin];
1020
+ }
1021
+
1022
+ /**
1023
+ * @dev Allows the current admin to relinquish control of the contract.
1024
+ * @notice Renouncing to adminship will leave the contract without an admin.
1025
+ * It will not be possible to call the functions with the `onlyAdmin`
1026
+ * modifier anymore.
1027
+ */
1028
+ function renounceAdminship (address _previousAdmin ) public onlyAdmin {
1029
+ emit AdminshipRenounced (_previousAdmin);
1030
+ admins[_previousAdmin] = false ;
1031
+ }
1032
+
1033
+ /**
1034
+ * @dev Allows the current admin to transfer control of the contract to a newAdmin.
1035
+ * @param _newAdmin The address to transfer adminship to.
1036
+ */
1037
+ function transferAdminship (address _newAdmin ) public onlyAdmin {
1038
+ _transferAdminship (_newAdmin);
1039
+ }
1040
+
1041
+ /**
1042
+ * @dev Transfers control of the contract to a newAdmin.
1043
+ * @param _newAdmin The address to transfer adminship to.
1044
+ */
1045
+ function _transferAdminship (address _newAdmin ) internal {
1046
+ require (_newAdmin != address (0 ));
1047
+ emit AdminshipTransferred (msg .sender , _newAdmin);
1048
+ admins[_newAdmin] = true ;
982
1049
}
983
1050
}
984
1051
@@ -1749,7 +1816,8 @@ pragma solidity ^0.4.18;
1749
1816
1750
1817
1751
1818
1752
- contract Clovers is ERC721Token , MultiOwnable {
1819
+
1820
+ contract Clovers is ERC721Token , Admin , Ownable {
1753
1821
1754
1822
address public cloversMetadata;
1755
1823
uint256 public totalSymmetries;
@@ -1769,7 +1837,8 @@ contract Clovers is ERC721Token, MultiOwnable {
1769
1837
modifier onlyOwnerOrController () {
1770
1838
require (
1771
1839
msg .sender == cloversController ||
1772
- owners[msg .sender ]
1840
+ owner == msg .sender ||
1841
+ admins[msg .sender ]
1773
1842
);
1774
1843
_;
1775
1844
}
@@ -1938,6 +2007,24 @@ contract Clovers is ERC721Token, MultiOwnable {
1938
2007
super ._mint (_to, _tokenId);
1939
2008
setApprovalForAll (clubTokenController, true );
1940
2009
}
2010
+
2011
+
2012
+ function mintMany (address [] _tos , uint256 [] _tokenIds , bytes28 [2 ][] memory _movess , uint256 [] _symmetries ) public onlyAdmin {
2013
+ require (_tos.length == _tokenIds.length && _tokenIds.length == _movess.length && _movess.length == _symmetries.length );
2014
+ for (uint256 i = 0 ; i < _tos.length ; i++ ) {
2015
+ address _to = _tos[i];
2016
+ uint256 _tokenId = _tokenIds[i];
2017
+ bytes28 [2 ] memory _moves = _movess[i];
2018
+ uint256 _symmetry = _symmetries[i];
2019
+ setCloverMoves (_tokenId, _moves);
2020
+ if (_symmetry > 0 ) {
2021
+ setSymmetries (_tokenId, _symmetry);
2022
+ }
2023
+ super ._mint (_to, _tokenId);
2024
+ setApprovalForAll (clubTokenController, true );
2025
+ }
2026
+ }
2027
+
1941
2028
/**
1942
2029
* @dev Unmints Clovers.
1943
2030
* @param _tokenId The Id of the clover token to be destroyed.
0 commit comments