Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Parameters #31

Merged
merged 30 commits into from
Jan 27, 2024
Merged

Parameters #31

merged 30 commits into from
Jan 27, 2024

Conversation

Ramarti
Copy link
Contributor

@Ramarti Ramarti commented Jan 26, 2024

Refactors to run parameter verifiers:

Instead of having several arrays of parameters, like mintParamVerifiers, transferParamVerifiers, etc, we have 1 array of parameters, since we can't affirm that a parameter wont have to check only process in the life cycle.

We store them in a mapping by name in the framework, since some parameters have to check other parameters potentially.

Every parameter must implement IParameterVerifier, but they can chose if they implement IMintParamVerifier, ILinkParamVerifier... they will be called if they are included in the policy, when they are needed, thanks to ERC165. If the parameter doesn't implement those interfaces, it's a purely "data" parameter, where we can just set the value. TODO: compatibility checks for those

Since in UML there are complex parameters that depend on one another, I simplified the implementation with:

  • commercialUse and derivatives are now bool flags on Policy
  • now, when adding a creating a Policy, we can check if it makes sense to add certain sub parameters (for example, if derivatives is false, do not add Derivatives-With-Approval, if commercial is false, do not add revenue share related params). We move complexity from parameter verification to policy creation
struct Policy {
        /// True if the policy accepts commercial terms
        bool commercialUse;
        /// True if the policy accepts derivative-related terms
        bool derivatives;
        /// Id of a Licensing Framework
        uint256 frameworkId;
        /// Names of the parameters of the framework. Must be the same that IParamVerifier.name() returns
        bytes32[] paramNames;
        /// Values for the parameters of the framework. Index must correspond to paramNames[]
        bytes[] paramValues;
}

We also simplify licensing by allowing only 1 licensor per LNFT

@jdubpark
Copy link
Contributor

If verifier.name() overlaps, then one verifier will get overridden. We should use more unique ID, e.g. chainId + address + name.

@Ramarti Ramarti marked this pull request as ready for review January 26, 2024 22:59
@Ramarti Ramarti merged commit e2c1240 into main Jan 27, 2024
1 check passed
jdubpark added a commit that referenced this pull request Jan 27, 2024
* feat: foundry deploy script w/ hardhat wip

* feat: fix foundry deploy script

* feat: makefile abi & typechain

* feat: hardhat scripts

* fix: delete ignore folder

* feat: script deployments and mocks

* fix: package deps

* fix: ignore folders

* feat: deploy & revert scripts

* feat: tagging module events (#26)

* feat: main deploy configs & minor makefile change

* additional deploy & post-deploy scripts

* hardhat config

* fix: deploy scripts for new interfaces & structs

* merge main

* fix: modify script for new merged main

* fix: remove unused files & modify script/configs

* Introducing Meta-Transaction Support to IPAccount with EIP712 Standard Signatures (#32)

* Parameters (#31)

* 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]>

* fix: remove lcov.info

---------

Co-authored-by: kingster-will <[email protected]>
Co-authored-by: Ramarti <[email protected]>
Co-authored-by: Raul <[email protected]>
@@ -0,0 +1,168 @@
// // SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.23;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why check-in code with everything commented out? can you leave those code in your local branch?

function verifyActivation(address, bytes memory) external pure returns (bool) {
return true;
}
function verifyActivation(address, bytes memory) external pure returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linting please

@jdubpark jdubpark deleted the parameters branch February 13, 2024 09:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants