-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CapabilityRegistry: add capability version (#12996)
* Add capability response type and configuration contract * MUST NOT override existing capability version * MUST match configuration contract interface * Add wrappers * Include a tag to core changeset * Update ICapabilityConfiguration * Regen wrappers
- Loading branch information
Showing
9 changed files
with
195 additions
and
10 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,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
#wip Keystone contract wrappers updated |
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,5 @@ | ||
--- | ||
"@chainlink/contracts": patch | ||
--- | ||
|
||
#wip addCapability udpates |
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
27 changes: 27 additions & 0 deletions
27
contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.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,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
/// @notice Interface for capability configuration contract. It MUST be | ||
/// implemented for a contract to be used as a capability configuration. | ||
/// The contract MAY store configuration that is shared across multiple | ||
/// DON instances and capability versions. | ||
/// @dev This interface does not guarantee the configuration contract's | ||
/// correctness. It is the responsibility of the contract owner to ensure | ||
/// that the configuration contract emits the CapabilityConfigurationSet | ||
/// event when the configuration is set. | ||
interface ICapabilityConfiguration { | ||
/// @notice Emitted when a capability configuration is set. | ||
event CapabilityConfigurationSet(); | ||
|
||
/// @notice Returns the capability configuration for a particular DON instance. | ||
/// @dev donId is required to get DON-specific configuration. It avoids a | ||
/// situation where configuration size grows too large. | ||
/// @param donId The DON instance ID. These are stored in the CapabilityRegistry. | ||
/// @return configuration DON's configuration for the capability. | ||
function getCapabilityConfiguration(uint256 donId) external view returns (bytes memory configuration); | ||
|
||
// Solidity does not support generic returns types, so this cannot be part of | ||
// the interface. However, the implementation contract MAY implement this | ||
// function to enable configuration decoding on-chain. | ||
// function decodeCapabilityConfiguration(bytes configuration) external returns (TypedCapabilityConfigStruct config) | ||
} |
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
13 changes: 13 additions & 0 deletions
13
contracts/src/v0.8/keystone/test/mocks/CapabilityConfigurationContract.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,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.19; | ||
|
||
import {ICapabilityConfiguration} from "../../interfaces/ICapabilityConfiguration.sol"; | ||
import {ERC165} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/ERC165.sol"; | ||
|
||
contract CapabilityConfigurationContract is ICapabilityConfiguration, ERC165 { | ||
mapping(uint256 => bytes) private s_donConfiguration; | ||
|
||
function getCapabilityConfiguration(uint256 donId) external view returns (bytes memory configuration) { | ||
return s_donConfiguration[donId]; | ||
} | ||
} |
Oops, something went wrong.