Skip to content

Commit

Permalink
add paymentGateway to MasaSBT
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcabot committed May 4, 2023
1 parent 3fe8af3 commit bc32c4c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 26 deletions.
15 changes: 13 additions & 2 deletions contracts/SoulboundIdentity.sol
Expand Up @@ -29,12 +29,23 @@ contract SoulboundIdentity is
/// @param name Name of the token
/// @param symbol Symbol of the token
/// @param baseTokenURI Base URI of the token
/// @param paymentParams Payment gateway params
constructor(
address admin,
string memory name,
string memory symbol,
string memory baseTokenURI
) MasaSBTAuthority(admin, name, symbol, baseTokenURI, address(0)) {}
string memory baseTokenURI,
PaymentParams memory paymentParams
)
MasaSBTAuthority(
admin,
name,
symbol,
baseTokenURI,
address(0),
paymentParams
)
{}

/* ========== RESTRICTED FUNCTIONS ====================================== */

Expand Down
15 changes: 13 additions & 2 deletions contracts/reference/ReferenceSBTAuthority.sol
Expand Up @@ -21,13 +21,24 @@ contract ReferenceSBTAuthority is MasaSBTAuthority {
/// @param symbol Symbol of the token
/// @param baseTokenURI Base URI of the token
/// @param soulboundIdentity Address of the SoulboundIdentity contract
/// @param paymentParams Payment gateway params
constructor(
address admin,
string memory name,
string memory symbol,
string memory baseTokenURI,
address soulboundIdentity
) MasaSBTAuthority(admin, name, symbol, baseTokenURI, soulboundIdentity) {}
address soulboundIdentity,
PaymentParams memory paymentParams
)
MasaSBTAuthority(
admin,
name,
symbol,
baseTokenURI,
soulboundIdentity,
paymentParams
)
{}

/* ========== RESTRICTED FUNCTIONS ====================================== */

Expand Down
11 changes: 7 additions & 4 deletions contracts/tokens/MasaSBT.sol
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "../dex/PaymentGateway.sol";
import "../libraries/Errors.sol";
import "../interfaces/ISoulboundIdentity.sol";
import "../interfaces/ILinkableSBT.sol";
Expand All @@ -16,10 +16,11 @@ import "./SBT/extensions/SBTBurnable.sol";
/// @notice Soulbound token. Non-fungible token that is not transferable.
/// @dev Implementation of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4105763 Soulbound token.
/// Adds a link to a SoulboundIdentity SC to let minting using the identityId
/// Adds a payment gateway to let minting paying a fee
abstract contract MasaSBT is
PaymentGateway,
SBT,
SBTEnumerable,
AccessControl,
SBTBurnable,
ILinkableSBT
{
Expand All @@ -45,13 +46,15 @@ abstract contract MasaSBT is
/// @param symbol Symbol of the token
/// @param baseTokenURI Base URI of the token
/// @param _soulboundIdentity Address of the SoulboundIdentity contract
/// @param paymentParams Payment gateway params
constructor(
address admin,
string memory name,
string memory symbol,
string memory baseTokenURI,
address _soulboundIdentity
) SBT(name, symbol) {
address _soulboundIdentity,
PaymentParams memory paymentParams
) SBT(name, symbol) PaymentGateway(admin, paymentParams) {
_grantRole(DEFAULT_ADMIN_ROLE, admin);

_baseTokenURI = baseTokenURI;
Expand Down
15 changes: 13 additions & 2 deletions contracts/tokens/MasaSBTAuthority.sol
Expand Up @@ -26,13 +26,24 @@ abstract contract MasaSBTAuthority is MasaSBT {
/// @param symbol Symbol of the token
/// @param baseTokenURI Base URI of the token
/// @param soulboundIdentity Address of the SoulboundIdentity contract
/// @param paymentParams Payment gateway params
constructor(
address admin,
string memory name,
string memory symbol,
string memory baseTokenURI,
address soulboundIdentity
) MasaSBT(admin, name, symbol, baseTokenURI, soulboundIdentity) {
address soulboundIdentity,
PaymentParams memory paymentParams
)
MasaSBT(
admin,
name,
symbol,
baseTokenURI,
soulboundIdentity,
paymentParams
)
{
_grantRole(MINTER_ROLE, admin);
}

Expand Down
25 changes: 9 additions & 16 deletions contracts/tokens/MasaSBTSelfSovereign.sol
Expand Up @@ -6,16 +6,14 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

import "../libraries/Errors.sol";
import "../dex/PaymentGateway.sol";
import "./MasaSBT.sol";

/// @title MasaSBTSelfSovereign
/// @author Masa Finance
/// @notice Soulbound token. Non-fungible token that is not transferable.
/// Adds a payment gateway to let minting paying a fee
/// Adds a self-sovereign protocol to let minting using an authority signature
/// @dev Implementation of https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4105763 Soulbound token.
abstract contract MasaSBTSelfSovereign is PaymentGateway, MasaSBT, EIP712 {
abstract contract MasaSBTSelfSovereign is MasaSBT, EIP712 {
/* ========== STATE VARIABLES =========================================== */

using Counters for Counters.Counter;
Expand Down Expand Up @@ -45,8 +43,14 @@ abstract contract MasaSBTSelfSovereign is PaymentGateway, MasaSBT, EIP712 {
address soulboundIdentity,
PaymentParams memory paymentParams
)
PaymentGateway(admin, paymentParams)
MasaSBT(admin, name, symbol, baseTokenURI, soulboundIdentity)
MasaSBT(
admin,
name,
symbol,
baseTokenURI,
soulboundIdentity,
paymentParams
)
{}

/* ========== RESTRICTED FUNCTIONS ====================================== */
Expand Down Expand Up @@ -130,17 +134,6 @@ abstract contract MasaSBTSelfSovereign is PaymentGateway, MasaSBT, EIP712 {
return (price, _getProtocolFee(paymentMethod, price));
}

/// @notice Query if a contract implements an interface
/// @dev Interface identification is specified in ERC-165.
/// @param interfaceId The interface identifier, as specified in ERC-165
/// @return `true` if the contract implements `interfaceId` and
/// `interfaceId` is not 0xffffffff, `false` otherwise
function supportsInterface(
bytes4 interfaceId
) public view virtual override(AccessControl, MasaSBT) returns (bool) {
return super.supportsInterface(interfaceId);
}

/* ========== PRIVATE FUNCTIONS ========================================= */

function _verify(
Expand Down

0 comments on commit bc32c4c

Please sign in to comment.