Staking Protocolmanager

CampaignAssetManager

Manages the staked (input) assets and reward (output) assets of a staking campaign.

_Serves as a generic vault that can hold any type of non-native tokens and execute arbitrary transactions.

IMPORTANT:

  • Ownership is assigned to the staking platform (diamond) that creates the staking campaign (see CampaignCreationSkeleton.sol).
  • Each staking campaign deploys two CampaignAssetManager contracts at creation: one for managing (holding) input (staked) assets and another for managing reward assets.
  • The reward manager either holds reward assets for distribution or has minting privileges on the reward token(s)._

InvalidZeroAddressTarget

error InvalidZeroAddressTarget()

Thrown at execute() when the zero address is provided as target.

NoDataToExecute

error NoDataToExecute()

Thrown at execute() when no data is provided.

ExecuteCalled

event ExecuteCalled(address target, bytes data)

Emitted when the execute() function is successfully executed.

constructor

constructor(address _initialOwner) public

Constructor.

See Ownable.sol.

execute

function execute(address target, bytes data) external returns (bytes)

This function is called by the contract's owner to make it call other functions.

Primarily used for token approvals, with the staking platform (owner) as the operator, or for minting.

Parameters

NameTypeDescription
targetaddressThe address of the target contract (e., token) to call.
databytesThe calldata to use in the contract call.

onERC721Received

function onERC721Received(address, address, uint256, bytes) external pure returns (bytes4)

_Whenever an {IERC721} tokenId token is transferred to this contract via {IERC721-safeTransferFrom} by operator from from, this function is called.

It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.

The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector._

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes) external pure returns (bytes4)

_Handles the receipt of a single ERC-1155 token type. This function is called at the end of a safeTransferFrom after the balance has been updated.

NOTE: To accept the transfer, this must return bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) (i.e. 0xf23a6e61, or its own function selector)._

Parameters

NameTypeDescription
address
address
uint256
uint256
bytes

Return Values

NameTypeDescription
[0]bytes4bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) if transfer is allowed

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[], uint256[], bytes) external pure returns (bytes4)

_Handles the receipt of a multiple ERC-1155 token types. This function is called at the end of a safeBatchTransferFrom after the balances have been updated.

NOTE: To accept the transfer(s), this must return bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) (i.e. 0xbc197c81, or its own function selector)._

Parameters

NameTypeDescription
address
address
uint256[]
uint256[]
bytes

Return Values

NameTypeDescription
[0]bytes4bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) if transfer is allowed

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

_Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] to learn more about how these ids are created.

This function call must use less than 30 000 gas._

On this page