This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
generated from storyprotocol/solidity-template
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added transfer terms, refactored term checking * add param test * unused var test * fix policy needs transfer arguments * fix tests, addPolicy public only allow new policies * licenseData not provided when minting, it is a result * added activation * wip: license activation * rolled back license status * removed activation related code * stray activation method * stray event * stray errors * fix comment * fix comment * WIP * comment * fixes * WIP * WIP: fix identification of policy set by linking * refactor to compile * fix except integration * feat: integration test fix, remove local vars, add reverts on verification * fix: verifier interfaces, integration test fix, mock verifier fix, remove local var * fix: rename contract, add constructor param for mock verifier, formats, more base contract, test fixes * fix: rename vars and clean stack * feat: flexible MockParamVerifier, modify integration/unit test runs * Update contracts/interfaces/licensing/IMintParamVerifier.sol --------- Co-authored-by: Raul <[email protected]> Co-authored-by: Jongwon Park <[email protected]>
- Loading branch information
1 parent
6de2d8b
commit e2c1240
Showing
16 changed files
with
742 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity ^0.8.23; | ||
|
||
import { IParamVerifier } from "contracts/interfaces/licensing/IParamVerifier.sol"; | ||
|
||
interface ILinkParamVerifier is IParamVerifier { | ||
function verifyLink( | ||
uint256 licenseId, | ||
address caller, | ||
address ipId, | ||
address parentIpId, | ||
bytes calldata data | ||
) external returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity ^0.8.23; | ||
import { IParamVerifier } from "contracts/interfaces/licensing/IParamVerifier.sol"; | ||
|
||
interface IMintParamVerifier is IParamVerifier { | ||
function verifyMint( | ||
address caller, | ||
uint256 policyId, | ||
bool policyAddedByLinking, | ||
address licensor, | ||
address receiver, | ||
uint256 mintAmount, | ||
bytes memory data | ||
) external returns (bool); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
// SPDX-License-Identifier: MIT | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity ^0.8.20; | ||
pragma solidity ^0.8.23; | ||
|
||
import { IERC165 } from "@openzeppelin/contracts/interfaces/IERC165.sol"; | ||
|
||
interface IParamVerifier is IERC165 { | ||
function name() external view returns (bytes32); | ||
|
||
function nameString() external view returns (string memory); | ||
|
||
interface IParamVerifier { | ||
function verifyMinting(address caller, uint256 amount, bytes memory data) external returns (bool); | ||
function verifyTransfer(address caller, uint256 amount, bytes memory data) external returns (bool); | ||
function verifyLinkParent(address caller, bytes memory data) external returns (bool); | ||
function json() external view returns (string memory); | ||
|
||
function allowsOtherPolicyOnSameIp(bytes memory data) external view returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity ^0.8.23; | ||
|
||
import { IParamVerifier } from "contracts/interfaces/licensing/IParamVerifier.sol"; | ||
|
||
interface ITransferParamVerifier is IParamVerifier { | ||
function verifyTransfer( | ||
uint256 licenseId, | ||
address from, | ||
address to, | ||
uint256 amount, | ||
bytes memory data | ||
) external returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
contracts/modules/licensing/parameters/BaseParamVerifier.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
// See https://github.com/storyprotocol/protocol-contracts/blob/main/StoryProtocol-AlphaTestingAgreement-17942166.3.pdf | ||
pragma solidity ^0.8.23; | ||
|
||
// contracts | ||
import { ILinkParamVerifier } from "contracts/interfaces/licensing/ILinkParamVerifier.sol"; | ||
import { IMintParamVerifier } from "contracts/interfaces/licensing/IMintParamVerifier.sol"; | ||
import { IParamVerifier } from "contracts/interfaces/licensing/IParamVerifier.sol"; | ||
import { ITransferParamVerifier } from "contracts/interfaces/licensing/ITransferParamVerifier.sol"; | ||
import { Errors } from "contracts/lib/Errors.sol"; | ||
import { LicenseRegistry } from "contracts/registries/LicenseRegistry.sol"; | ||
import { ShortStringOps } from "contracts/utils/ShortStringOps.sol"; | ||
|
||
abstract contract BaseParamVerifier is IParamVerifier { | ||
// /// @notice Gets the protocol-wide module access controller. | ||
// IAccessController public immutable ACCESS_CONTROLLER; | ||
|
||
// /// @notice Gets the protocol-wide IP account registry. | ||
// IPAccountRegistry public immutable IP_ACCOUNT_REGISTRY; | ||
|
||
// /// @notice Gets the protocol-wide IP record registry. | ||
// IPRecordRegistry public immutable IP_RECORD_REGISTRY; | ||
|
||
/// @notice Gets the protocol-wide license registry. | ||
LicenseRegistry public immutable LICENSE_REGISTRY; | ||
|
||
string internal NAME; | ||
|
||
/// @notice Initializes the base module contract. | ||
/// @param licenseRegistry The address of the license registry. | ||
constructor(address licenseRegistry, string memory name_) { | ||
LICENSE_REGISTRY = LicenseRegistry(licenseRegistry); | ||
NAME = name_; | ||
} | ||
|
||
/// @notice Modifier for authorizing the calling entity. | ||
modifier onlyLicenseRegistry() { | ||
if (msg.sender != address(LICENSE_REGISTRY)) { | ||
revert Errors.BaseParamVerifier__Unauthorized(); | ||
} | ||
_; | ||
} | ||
|
||
function name() external view override returns (bytes32) { | ||
return ShortStringOps.stringToBytes32(NAME); | ||
} | ||
|
||
function nameString() external view override returns (string memory) { | ||
return NAME; | ||
} | ||
|
||
// TODO: implement flexible json() | ||
function json() external view returns (string memory) { | ||
return ""; | ||
} | ||
} |
Oops, something went wrong.