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
Thrown at execute()
when the zero address is provided as target.
NoDataToExecute
Thrown at execute()
when no data is provided.
ExecuteCalled
Emitted when the execute()
function is successfully executed.
constructor
Constructor.
See Ownable.sol
.
execute
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
Name | Type | Description |
---|---|---|
target | address | The address of the target contract (e., token) to call. |
data | bytes | The calldata to use in the contract call. |
onERC721Received
_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
_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
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256 | ||
uint256 | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) if transfer is allowed |
onERC1155BatchReceived
_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
Name | Type | Description |
---|---|---|
address | ||
address | ||
uint256[] | ||
uint256[] | ||
bytes |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes4 | bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)")) if transfer is allowed |
supportsInterface
_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._