Skip to content

[DRAFT] Polymorphic Price Config #135

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

Open
wants to merge 4 commits into
base: rc/zchain-native-main
Choose a base branch
from
Open
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
30 changes: 9 additions & 21 deletions contracts/price/IZNSCurvePricer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface IZNSCurvePricer is ICurvePriceConfig, IZNSPricer {
* @notice Reverted when multiplier passed by the domain owner
* is equal to 0 or more than 10^18, which is too large.
*/
error InvalidPrecisionMultiplierPassed(bytes32 domainHash);
// error InvalidPrecisionMultiplierPassed(bytes32 domainHash);
error InvalidPrecisionMultiplierPassed();

/**
* @notice Emitted when the `maxPrice` is set in `CurvePriceConfig`
Expand Down Expand Up @@ -70,12 +71,16 @@ interface IZNSCurvePricer is ICurvePriceConfig, IZNSPricer {

function initialize(
address accessController_,
address registry_,
CurvePriceConfig calldata zeroPriceConfig_
address registry_
// CurvePriceConfig calldata zeroPriceConfig_
) external;

function encodeConfig(
CurvePriceConfig calldata config
) external returns(bytes memory);

function getPrice(
bytes32 parentHash,
bytes memory parentPriceConfig,
string calldata label,
bool skipValidityCheck
) external view returns (uint256);
Expand All @@ -94,22 +99,5 @@ interface IZNSCurvePricer is ICurvePriceConfig, IZNSPricer {
uint256 stakeFee
);

function setPriceConfig(
bytes32 domainHash,
CurvePriceConfig calldata priceConfig
) external;

function setMaxPrice(bytes32 domainHash, uint256 maxPrice) external;

function setBaseLength(bytes32 domainHash, uint256 length) external;

function setMaxLength(bytes32 domainHash, uint256 length) external;

function setCurveMultiplier(bytes32 domainHash, uint256 curveMultiplier) external;

function setPrecisionMultiplier(bytes32 domainHash, uint256 multiplier) external;

function setFeePercentage(bytes32 domainHash, uint256 feePercentage) external;

function setRegistry(address registry_) external;
}
19 changes: 3 additions & 16 deletions contracts/price/IZNSFixedPricer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,14 @@ interface IZNSFixedPricer is IZNSPricer {

function initialize(address _accessController, address _registry) external;

function setPrice(bytes32 domainHash, uint256 _price) external;

function getPrice(
bytes32 parentHash,
bytes memory parentPriceConfig,
string calldata label,
bool skipValidityCheck
) external view returns (uint256);

function setFeePercentage(
bytes32 domainHash,
uint256 feePercentage
) external;
) external pure returns (uint256);

function getFeeForPrice(
bytes32 parentHash,
uint256 price
bytes memory parentPriceConfig
) external view returns (uint256);

function getPriceAndFee(
Expand All @@ -59,10 +51,5 @@ interface IZNSFixedPricer is IZNSPricer {
bool skipValidityCheck
) external view returns (uint256 price, uint256 fee);

function setPriceConfig(
bytes32 domainHash,
PriceConfig calldata priceConfig
) external;

function setRegistry(address registry_) external;
}
Loading