Skip to content
Verified contractPartialMIT

HowlerzStake

Address0x265b7249aec7697be35b9aacaf9deefdf1ee886f
Balance

0 ETH

 

Transactions

382

 

Compiler

solc 0.8.13

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.13+commit.abaa5c0e
Language
solidity
Optimization
No
EVM version
london
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
16,551,757
Creation transaction
0xc82b6888bf…c84ee9d9c9

/contracts/HowlerzStake.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";

interface IChamps {
  function transferFrom(address from, address to, uint256 tokenId) external;
  function registerChampion(uint tokenId) external;
}

contract HowlerzStake is IERC721Receiver {
  address constant public howlerz = 0x4f32dEfF86Daed546e5A9A10C98e068f9bB5eA60;

  mapping (address => uint[]) public stakedChamps;
  
  function stakeChamps (uint[] memory champIds) public {
    IChamps champs = IChamps(howlerz);
    for (uint i = 0; i < champIds.length; i++) {
      champs.transferFrom(msg.sender, address(this), champIds[i]);
      stakedChamps[msg.sender].push(champIds[i]);
      champs.registerChampion(champIds[i]);
    }
  }

  function returnChamps () public {
    IChamps champs = IChamps(howlerz);
    uint i = stakedChamps[msg.sender].length;
    while (i > 0) {
      champs.transferFrom(address(this), msg.sender, stakedChamps[msg.sender][i - 1]);
      stakedChamps[msg.sender].pop();
      i--;
    }
  }

  function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public override returns (bytes4) {
    // stakedChamps[from].push(tokenId);
    return this.onERC721Received.selector;
  }
}

@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev 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`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "london",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.