Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Phygital and major changes #78

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions contracts/accessmaster/AccessMaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
contract AccessMaster is AccessControlEnumerable {
string public name = "My AccessMaster";
string public symbol = "AM";
uint8 public version = 1;
uint8 public constant version = 1;

address private payoutAddress;

bytes32 public constant FLOW_ADMIN_ROLE = keccak256("FLOW_ADMIN_ROLE");
Expand Down Expand Up @@ -69,17 +69,19 @@ contract AccessMaster is AccessControlEnumerable {
/// @dev Sets the payout address.
/// @param _payoutAddress The new address to receive funds from multiple contracts.
/// @notice Only the admin can set the payout address.
function setPayoutAddress(address _payoutAddress) external {
require(hasRole(FLOW_ADMIN_ROLE,_msgSender()),"AccessMaster: User is not authorized");
function setPayoutAddress(address _payoutAddress) external {
require(
hasRole(FLOW_ADMIN_ROLE, _msgSender()),
"AccessMaster: User is not authorized"
);
payoutAddress = _payoutAddress;
}

/**
/**
* @notice Retrieves the payout address defined by the admin.
* @return The payout address for receiving funds.
*/
function getPayoutAddress() external view returns (address) {
return payoutAddress;
return payoutAddress;
}

}
3 changes: 2 additions & 1 deletion contracts/eternalsoul/EternalSoul.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract EternalSoul is Context, ERC721Enumerable, EIP712 {
uint256 public nftPrice;
uint256 private Counter;
uint8 public version = 1;

uint8 public constant version = 1;

address public accessMasterAddress;

Expand Down
2 changes: 1 addition & 1 deletion contracts/eturnumpass/EternumPass.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract EternumPass is Context, IERC4907, IERC5643, ERC2981, ERC721Enumerable {
uint256 public subscriptionPricePerMonth;
uint256 public tokenIdCounter;

uint8 public version = 1;
uint8 public constant version = 1;

string public baseURI;

Expand Down
23 changes: 17 additions & 6 deletions contracts/fusionseries/FusionSeries.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ import "../accessmaster/interfaces/IAccessMaster.sol";
// collection URI override

contract FusionSeries is Context, ERC1155Supply {

string public name;
string public symbol;

address public tradeHub;
address public accessMasterAddress;

uint256 public Counter;
uint8 public version = 1;

uint8 public constant version = 1;
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;

Expand Down Expand Up @@ -60,7 +58,10 @@ contract FusionSeries is Context, ERC1155Supply {
uint256 indexed amount,
string metadataUri
);
event FusionSeriesAssetDestroyed(uint indexed tokenId, address ownerOrApproved);
event FusionSeriesAssetDestroyed(
uint indexed tokenId,
address ownerOrApproved
);

// tradeHub should be there
/**
Expand Down Expand Up @@ -104,7 +105,12 @@ contract FusionSeries is Context, ERC1155Supply {
_mint(_msgSender(), currentTokenID, amount, data);
_tokenURIs[currentTokenID] = _uri;
setApprovalForAll(tradeHub, true);
emit FusionSeriesAssetCreated(currentTokenID, _msgSender(), amount,_uri);
emit FusionSeriesAssetCreated(
currentTokenID,
_msgSender(),
amount,
_uri
);
return currentTokenID;
}

Expand All @@ -130,7 +136,12 @@ contract FusionSeries is Context, ERC1155Supply {
_mint(creator, currentTokenID, amount, data);
_tokenURIs[currentTokenID] = _uri;
setApprovalForAll(tradeHub, true);
emit FusionSeriesAssetCreated(currentTokenID, _msgSender(), amount,_uri);
emit FusionSeriesAssetCreated(
currentTokenID,
_msgSender(),
amount,
_uri
);
return currentTokenID;
}

Expand Down
36 changes: 18 additions & 18 deletions contracts/instagen/InstaGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "../accessmaster/interfaces/IAccessMaster.sol";
* - token ID and URI autogeneration
* - ability for holders to give for (4)
* - royalty is present for admin (2981)
*
*
*
* This contract uses {AccessControl} to lock permissioned functions using the
* different roles - head to its documentation for details.
Expand All @@ -23,7 +23,7 @@ import "../accessmaster/interfaces/IAccessMaster.sol";
* roles, as well as the default admin role, which will let it grant both creator
* and pauser roles to other accounts.
*/
contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
contract InstaGen is Context, IERC4907, ERC2981, ERC721A, ERC721ABurnable {
// Set Constants for Interface ID and Roles
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;

Expand All @@ -34,7 +34,7 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {

uint256 public immutable maxSupply;

uint8 public version = 1;
uint8 public constant version = 1;

// PUBLIC && PRIVATE VARIABLES
string private baseURI;
Expand All @@ -55,7 +55,7 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
// INTERFACES
IACCESSMASTER flowRoles;

modifier onlyOperator() {
modifier onlyOperator() {
require(
flowRoles.isOperator(_msgSender()),
"EternumPass: Unauthorized!"
Expand All @@ -68,10 +68,15 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
uint256 quantity,
address indexed creator
);

event InstaGenAssetDestroyed(uint indexed tokenId, address ownerOrApproved);

event FundTransferred(address sender,address reciepient , uint256 tokenId,uint256 amount);
event FundTransferred(
address sender,
address reciepient,
uint256 tokenId,
uint256 amount
);

event RentalInfo(
uint256 tokenId,
Expand Down Expand Up @@ -100,27 +105,24 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
maxSupply = _maxSupply;
baseURI = _baseUri;
// SET DEFAULT ROYALTY
_setDefaultRoyalty(_msgSender(), uint96(_royaltyBPS));
_setDefaultRoyalty(_msgSender(), uint96(_royaltyBPS));

accessMasterAddress = accessControlAddress;
}

/// @dev transferring funds
/// @dev transferring funds
function _transferFunds(
address sender,
address recipient,
uint256 tokenId,
uint256 amount
) private {
// get the balance of the contract
(bool callSuccess, ) = payable(recipient).call{
value: amount
}("");
(bool callSuccess, ) = payable(recipient).call{value: amount}("");
require(callSuccess, "InstaGen: Transfer failed");
emit FundTransferred(sender,recipient,tokenId,amount);
emit FundTransferred(sender, recipient, tokenId, amount);
}


function setSalePrice(uint256 _salePrice) external onlyOperator {
salePrice = _salePrice;
}
Expand Down Expand Up @@ -148,7 +150,7 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
setApprovalForAll(tradeHub, true);

address recipient = flowRoles.getPayoutAddress();
_transferFunds(_msgSender(),recipient,quantity,msg.value);
_transferFunds(_msgSender(), recipient, quantity, msg.value);

emit InstaGenAssetCreated(_totalMinted(), quantity, _msgSender());
return (prevQuantity, quantity);
Expand Down Expand Up @@ -224,9 +226,7 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
/// time cannot be less than 1 hour or more than 6 months
/// @param _timeInHours is in hours , Ex- 1,2,3
function rent(uint256 _tokenId, uint256 _timeInHours) external payable {
require(_exists(_tokenId),
"SignatureSeries: Invalide Token Id"
);
require(_exists(_tokenId), "SignatureSeries: Invalide Token Id");
require(
rentables[_tokenId].isRentable,
"InstaGen: Not available for rent"
Expand All @@ -244,7 +244,7 @@ contract InstaGen is Context,IERC4907,ERC2981, ERC721A, ERC721ABurnable {
uint256 amount = amountRequired(_tokenId, _timeInHours);

require(msg.value >= amount, "InstaGen: Insufficient Funds");
_transferFunds(_msgSender(),ownerOf(_tokenId),_tokenId,msg.value);
_transferFunds(_msgSender(), ownerOf(_tokenId), _tokenId, msg.value);

RentableItems storage info = rentables[_tokenId];
info.user = _msgSender();
Expand Down
Loading
Loading