-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 additions
and
71 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,30 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.28; | ||
|
||
import {OlasMech} from "./OlasMech.sol"; | ||
|
||
/// @title MechFixedPriceBase - Smart contract for OlasMech that accepts a fixed price payment for services. | ||
abstract contract MechFixedPriceBase is OlasMech { | ||
/// @dev MechFixedPriceBase constructor. | ||
/// @param _mechMarketplace Mech marketplace address. | ||
/// @param _serviceRegistry Address of the token contract. | ||
/// @param _serviceId Service Id. | ||
/// @param _maxDeliveryRate The maximum delivery rate. | ||
/// @param _paymentType Payment type. | ||
constructor(address _mechMarketplace, address _serviceRegistry, uint256 _serviceId, uint256 _maxDeliveryRate, bytes32 _paymentType) | ||
OlasMech(_mechMarketplace, _serviceRegistry, _serviceId, _maxDeliveryRate, _paymentType) | ||
{} | ||
|
||
/// @dev Performs actions before the delivery of a request. | ||
/// @param data Self-descriptive opaque data-blob. | ||
/// @return requestData Data for the request processing. | ||
function _preDeliver(address, uint256, bytes memory data) internal virtual override returns (bytes memory requestData) { | ||
requestData = data; | ||
} | ||
|
||
/// @dev Gets finalized delivery rate for a request Id. | ||
/// @return Finalized delivery rate. | ||
function getFinalizedDeliveryRate(uint256) external virtual override returns (uint256) { | ||
return maxDeliveryRate; | ||
} | ||
} |
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,32 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.28; | ||
|
||
import {OlasMech} from "../../OlasMech.sol"; | ||
import {MechFixedPriceBase} from "../../MechFixedPriceBase.sol"; | ||
|
||
/// @title MechFixedPriceNative - Smart contract for OlasMech that accepts a fixed price payment for services in native token. | ||
contract MechFixedPriceNative is OlasMech { | ||
contract MechFixedPriceNative is MechFixedPriceBase { | ||
// keccak256(FixedPriceNative) = ba699a34be8fe0e7725e93dcbce1701b0211a8ca61330aaeb8a05bf2ec7abed1 | ||
bytes32 public constant PAYMENT_TYPE = 0xba699a34be8fe0e7725e93dcbce1701b0211a8ca61330aaeb8a05bf2ec7abed1; | ||
|
||
/// @dev AgentMech constructor. | ||
/// @dev MechFixedPriceNative constructor. | ||
/// @param _mechMarketplace Mech marketplace address. | ||
/// @param _serviceRegistry Address of the token contract. | ||
/// @param _serviceId Service Id. | ||
/// @param _maxDeliveryRate The maximum delivery rate. | ||
constructor(address _mechMarketplace, address _serviceRegistry, uint256 _serviceId, uint256 _maxDeliveryRate) | ||
OlasMech(_mechMarketplace, _serviceRegistry, _serviceId, _maxDeliveryRate, PAYMENT_TYPE) | ||
MechFixedPriceBase(_mechMarketplace, _serviceRegistry, _serviceId, _maxDeliveryRate, PAYMENT_TYPE) | ||
{} | ||
|
||
/// @dev Performs actions before the delivery of a request. | ||
/// @param data Self-descriptive opaque data-blob. | ||
/// @return requestData Data for the request processing. | ||
function _preDeliver(address, uint256, bytes memory data) internal virtual override returns (bytes memory requestData) { | ||
requestData = data; | ||
} | ||
|
||
/// @dev Gets finalized delivery rate for a request Id. | ||
/// @return Finalized delivery rate. | ||
function getFinalizedDeliveryRate(uint256) external virtual override returns (uint256) { | ||
return maxDeliveryRate; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.28; | ||
|
||
import {OlasMech} from "../../OlasMech.sol"; | ||
import {MechFixedPriceBase} from "../../MechFixedPriceBase.sol"; | ||
|
||
/// @title MechFixedPriceToken - Smart contract for OlasMech that accepts a fixed price payment for services in native token. | ||
contract MechFixedPriceToken is OlasMech { | ||
contract MechFixedPriceToken is MechFixedPriceBase { | ||
// keccak256(FixedPriceToken) = 3679d66ef546e66ce9057c4a052f317b135bc8e8c509638f7966edfd4fcf45e9 | ||
bytes32 public constant PAYMENT_TYPE = 0x3679d66ef546e66ce9057c4a052f317b135bc8e8c509638f7966edfd4fcf45e9; | ||
|
||
/// @dev AgentMech constructor. | ||
/// @dev MechFixedPriceToken constructor. | ||
/// @param _mechMarketplace Mech marketplace address. | ||
/// @param _serviceRegistry Address of the token contract. | ||
/// @param _serviceId Service Id. | ||
/// @param _maxDeliveryRate The maximum delivery rate. | ||
constructor(address _mechMarketplace, address _serviceRegistry, uint256 _serviceId, uint256 _maxDeliveryRate) | ||
OlasMech(_mechMarketplace, _serviceRegistry, _serviceId, _maxDeliveryRate, PAYMENT_TYPE) | ||
MechFixedPriceBase(_mechMarketplace, _serviceRegistry, _serviceId, _maxDeliveryRate, PAYMENT_TYPE) | ||
{} | ||
|
||
/// @dev Performs actions before the delivery of a request. | ||
/// @param data Self-descriptive opaque data-blob. | ||
/// @return requestData Data for the request processing. | ||
function _preDeliver(address, uint256, bytes memory data) internal virtual override returns (bytes memory requestData) { | ||
requestData = data; | ||
} | ||
|
||
/// @dev Gets finalized delivery rate for a request Id. | ||
/// @return Finalized delivery rate. | ||
function getFinalizedDeliveryRate(uint256) external virtual override returns (uint256) { | ||
return maxDeliveryRate; | ||
} | ||
} |