Skip to content

Commit cf62ac8

Browse files
committed
flatten
1 parent b8fb9e5 commit cf62ac8

File tree

5 files changed

+406
-267
lines changed

5 files changed

+406
-267
lines changed

flat_contracts/Clovers.sol

Lines changed: 103 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ contract ERC721Token is SupportsInterfaceWithLookup, ERC721BasicToken, ERC721 {
911911

912912
}
913913

914-
// File: contracts/helpers/MultiOwnable.sol
914+
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
915915

916916
pragma solidity ^0.4.24;
917917

@@ -921,8 +921,8 @@ pragma solidity ^0.4.24;
921921
* @dev The Ownable contract has an owner address, and provides basic authorization control
922922
* functions, this simplifies the implementation of "user permissions".
923923
*/
924-
contract MultiOwnable {
925-
mapping (address => bool) public owners;
924+
contract Ownable {
925+
address public owner;
926926

927927

928928
event OwnershipRenounced(address indexed previousOwner);
@@ -937,30 +937,26 @@ contract MultiOwnable {
937937
* account.
938938
*/
939939
constructor() public {
940-
owners[msg.sender] = true;
940+
owner = msg.sender;
941941
}
942942

943943
/**
944944
* @dev Throws if called by any account other than the owner.
945945
*/
946946
modifier onlyOwner() {
947-
require(owners[msg.sender]);
947+
require(msg.sender == owner);
948948
_;
949949
}
950950

951-
function isOwner(address _isOwner) public view returns(bool) {
952-
return owners[_isOwner];
953-
}
954-
955951
/**
956952
* @dev Allows the current owner to relinquish control of the contract.
957953
* @notice Renouncing to ownership will leave the contract without an owner.
958954
* It will not be possible to call the functions with the `onlyOwner`
959955
* modifier anymore.
960956
*/
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);
964960
}
965961

966962
/**
@@ -977,8 +973,79 @@ contract MultiOwnable {
977973
*/
978974
function _transferOwnership(address _newOwner) internal {
979975
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;
9821049
}
9831050
}
9841051

@@ -1749,7 +1816,8 @@ pragma solidity ^0.4.18;
17491816

17501817

17511818

1752-
contract Clovers is ERC721Token, MultiOwnable {
1819+
1820+
contract Clovers is ERC721Token, Admin, Ownable {
17531821

17541822
address public cloversMetadata;
17551823
uint256 public totalSymmetries;
@@ -1769,7 +1837,8 @@ contract Clovers is ERC721Token, MultiOwnable {
17691837
modifier onlyOwnerOrController() {
17701838
require(
17711839
msg.sender == cloversController ||
1772-
owners[msg.sender]
1840+
owner == msg.sender ||
1841+
admins[msg.sender]
17731842
);
17741843
_;
17751844
}
@@ -1938,6 +2007,24 @@ contract Clovers is ERC721Token, MultiOwnable {
19382007
super._mint(_to, _tokenId);
19392008
setApprovalForAll(clubTokenController, true);
19402009
}
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+
19412028
/**
19422029
* @dev Unmints Clovers.
19432030
* @param _tokenId The Id of the clover token to be destroyed.

0 commit comments

Comments
 (0)