Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x0bb4D3e88243F4A057Db77341e6916B0e449b158
Balance 0 ETH
Nonce 1
Code Size 9330 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

9330 bytes
0x6080604052600436106100f35760003560e01c80638456cb591161008a578063af68b30211610059578063af68b302146102ba578063b3f00674146102ea578063efdcd97414610315578063f2fde38b1461033e576100f3565b80638456cb59146102105780638da5cb5b14610227578063a3f4df7e14610252578063ac13e2cf1461027d576100f3565b806346dcab55116100c657806346dcab551461017a5780635c975abb146101a557806366f20b4f146101d0578063715018a6146101f9576100f3565b806312d8b659146100f85780631cc7d7431461012157806325e599761461014c5780633f4ba83a14610163575b600080fd5b34801561010457600080fd5b5061011f600480360381019061011a919061163f565b610367565b005b34801561012d57600080fd5b50610136610519565b604051610143919061167b565b60405180910390f35b34801561015857600080fd5b5061016161053f565b005b34801561016f57600080fd5b5061017861063d565b005b34801561018657600080fd5b5061018f6106c3565b60405161019c91906116af565b60405180910390f35b3480156101b157600080fd5b506101ba6106c9565b6040516101c791906116e5565b60405180910390f35b3480156101dc57600080fd5b506101f760048036038101906101f2919061172c565b6106df565b005b34801561020557600080fd5b5061020e61079b565b005b34801561021c57600080fd5b50610225610823565b005b34801561023357600080fd5b5061023c6108a9565b604051610249919061167b565b60405180910390f35b34801561025e57600080fd5b506102676108d2565b60405161027491906117f2565b60405180910390f35b34801561028957600080fd5b506102a4600480360381019061029f9190611949565b61090b565b6040516102b191906116e5565b60405180910390f35b6102d460048036038101906102cf91906119f2565b610941565b6040516102e191906116e5565b60405180910390f35b3480156102f657600080fd5b506102ff610c9d565b60405161030c9190611aad565b60405180910390f35b34801561032157600080fd5b5061033c60048036038101906103379190611af4565b610cc3565b005b34801561034a57600080fd5b506103656004803603810190610360919061163f565b610e05565b005b61036f610efd565b73ffffffffffffffffffffffffffffffffffffffff1661038d6108a9565b73ffffffffffffffffffffffffffffffffffffffff16146103e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103da90611b6d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610453576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044a90611bff565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f5a0187d944e32a2b0f75447aa4204770b7ce48a54b5b50461657cb885bb0743860405160405180910390a35050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610547610efd565b73ffffffffffffffffffffffffffffffffffffffff166105656108a9565b73ffffffffffffffffffffffffffffffffffffffff16146105bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b290611b6d565b60405180910390fd5b7f00000000000000000000000022c1f6050e56d2876009903609a2cc3fef83b41573ffffffffffffffffffffffffffffffffffffffff16638bad0c0a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561062357600080fd5b505af1158015610637573d6000803e3d6000fd5b50505050565b610645610efd565b73ffffffffffffffffffffffffffffffffffffffff166106636108a9565b73ffffffffffffffffffffffffffffffffffffffff16146106b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b090611b6d565b60405180910390fd5b6106c1610f05565b565b60035481565b60008060149054906101000a900460ff16905090565b6106e7610efd565b73ffffffffffffffffffffffffffffffffffffffff166107056108a9565b73ffffffffffffffffffffffffffffffffffffffff161461075b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075290611b6d565b60405180910390fd5b600060035490508160038190555081817f5dcfc17c6761123f8f252be194a2b2ff45d3fc49d36157c144449635cd18a39b60405160405180910390a35050565b6107a3610efd565b73ffffffffffffffffffffffffffffffffffffffff166107c16108a9565b73ffffffffffffffffffffffffffffffffffffffff1614610817576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080e90611b6d565b60405180910390fd5b6108216000610fa6565b565b61082b610efd565b73ffffffffffffffffffffffffffffffffffffffff166108496108a9565b73ffffffffffffffffffffffffffffffffffffffff161461089f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089690611b6d565b60405180910390fd5b6108a761106a565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6040518060400160405280600b81526020017f504f41502042726964676500000000000000000000000000000000000000000081525081565b6004818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900460ff1681565b600061094b6106c9565b1561098b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098290611c6b565b60405180910390fd5b8342106109cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c490611cd7565b60405180910390fd5b600354341015610a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0990611d43565b60405180910390fd5b610a638787878787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061110d565b610aa2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9990611daf565b60405180910390fd5b6000151560048484604051610ab8929190611dff565b908152602001604051809103902060009054906101000a900460ff16151514610b16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0d90611e64565b60405180910390fd5b600160048484604051610b2a929190611dff565b908152602001604051809103902060006101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610bb7573d6000803e3d6000fd5b507f1a07b5f8b63c3cf278e4ca93489913e97d8d203465bbca7c175f79f044751f898383604051610be9929190611ec2565b60405180910390a17f00000000000000000000000022c1f6050e56d2876009903609a2cc3fef83b41573ffffffffffffffffffffffffffffffffffffffff1663d890c8e28888886040518463ffffffff1660e01b8152600401610c4e93929190611ee6565b6020604051808303816000875af1158015610c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c919190611f49565b90509695505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ccb610efd565b73ffffffffffffffffffffffffffffffffffffffff16610ce96108a9565b73ffffffffffffffffffffffffffffffffffffffff1614610d3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3690611b6d565b60405180910390fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fc48b0e51c214a466e3adac62fd8111199ecd644b9c9a8e87b2c7f8b710c8422b60405160405180910390a35050565b610e0d610efd565b73ffffffffffffffffffffffffffffffffffffffff16610e2b6108a9565b73ffffffffffffffffffffffffffffffffffffffff1614610e81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7890611b6d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ef1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee890611fe8565b60405180910390fd5b610efa81610fa6565b50565b600033905090565b610f0d6106c9565b610f4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4390612054565b60405180910390fd5b60008060146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa610f8f610efd565b604051610f9c919061167b565b60405180910390a1565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6110726106c9565b156110b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110a990611c6b565b60405180910390fd5b6001600060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586110f6610efd565b604051611103919061167b565b60405180910390a1565b60006041825114611153576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114a906120c0565b60405180910390fd5b60008686868660405160200161116c9493929190612149565b604051602081830303815290604052805190602001209050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111d084836111f390919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff161491505095945050505050565b6000806000611202858561121a565b9150915061120f8161129d565b819250505092915050565b60008060418351141561125c5760008060006020860151925060408601519150606086015160001a905061125087828585611472565b94509450505050611296565b60408351141561128d57600080602085015191506040850151905061128286838361157f565b935093505050611296565b60006002915091505b9250929050565b600060048111156112b1576112b0612197565b5b8160048111156112c4576112c3612197565b5b14156112cf5761146f565b600160048111156112e3576112e2612197565b5b8160048111156112f6576112f5612197565b5b1415611337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161132e90612212565b60405180910390fd5b6002600481111561134b5761134a612197565b5b81600481111561135e5761135d612197565b5b141561139f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113969061227e565b60405180910390fd5b600360048111156113b3576113b2612197565b5b8160048111156113c6576113c5612197565b5b1415611407576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fe90612310565b60405180910390fd5b60048081111561141a57611419612197565b5b81600481111561142d5761142c612197565b5b141561146e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611465906123a2565b60405180910390fd5b5b50565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c11156114ad576000600391509150611576565b601b8560ff16141580156114c55750601c8560ff1614155b156114d7576000600491509150611576565b6000600187878787604051600081526020016040526040516114fc94939291906123f7565b6020604051602081039080840390855afa15801561151e573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561156d57600060019250925050611576565b80600092509250505b94509492505050565b6000806000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff85169150601b8560ff1c0190506115bf87828885611472565b935093505050935093915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061160c826115e1565b9050919050565b61161c81611601565b811461162757600080fd5b50565b60008135905061163981611613565b92915050565b600060208284031215611655576116546115d7565b5b60006116638482850161162a565b91505092915050565b61167581611601565b82525050565b6000602082019050611690600083018461166c565b92915050565b6000819050919050565b6116a981611696565b82525050565b60006020820190506116c460008301846116a0565b92915050565b60008115159050919050565b6116df816116ca565b82525050565b60006020820190506116fa60008301846116d6565b92915050565b61170981611696565b811461171457600080fd5b50565b60008135905061172681611700565b92915050565b600060208284031215611742576117416115d7565b5b600061175084828501611717565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611793578082015181840152602081019050611778565b838111156117a2576000848401525b50505050565b6000601f19601f8301169050919050565b60006117c482611759565b6117ce8185611764565b93506117de818560208601611775565b6117e7816117a8565b840191505092915050565b6000602082019050818103600083015261180c81846117b9565b905092915050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611856826117a8565b810181811067ffffffffffffffff821117156118755761187461181e565b5b80604052505050565b60006118886115cd565b9050611894828261184d565b919050565b600067ffffffffffffffff8211156118b4576118b361181e565b5b6118bd826117a8565b9050602081019050919050565b82818337600083830152505050565b60006118ec6118e784611899565b61187e565b90508281526020810184848401111561190857611907611819565b5b6119138482856118ca565b509392505050565b600082601f8301126119305761192f611814565b5b81356119408482602086016118d9565b91505092915050565b60006020828403121561195f5761195e6115d7565b5b600082013567ffffffffffffffff81111561197d5761197c6115dc565b5b6119898482850161191b565b91505092915050565b600080fd5b600080fd5b60008083601f8401126119b2576119b1611814565b5b8235905067ffffffffffffffff8111156119cf576119ce611992565b5b6020830191508360018202830111156119eb576119ea611997565b5b9250929050565b60008060008060008060a08789031215611a0f57611a0e6115d7565b5b6000611a1d89828a01611717565b9650506020611a2e89828a01611717565b9550506040611a3f89828a0161162a565b9450506060611a5089828a01611717565b935050608087013567ffffffffffffffff811115611a7157611a706115dc565b5b611a7d89828a0161199c565b92509250509295509295509295565b6000611a97826115e1565b9050919050565b611aa781611a8c565b82525050565b6000602082019050611ac26000830184611a9e565b92915050565b611ad181611a8c565b8114611adc57600080fd5b50565b600081359050611aee81611ac8565b92915050565b600060208284031215611b0a57611b096115d7565b5b6000611b1884828501611adf565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611b57602083611764565b9150611b6282611b21565b602082019050919050565b60006020820190508181036000830152611b8681611b4a565b9050919050565b7f546865207a65726f20616464726573732063616e277420626520612076616c6960008201527f64207369676e6572000000000000000000000000000000000000000000000000602082015250565b6000611be9602883611764565b9150611bf482611b8d565b604082019050919050565b60006020820190508181036000830152611c1881611bdc565b9050919050565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b6000611c55601083611764565b9150611c6082611c1f565b602082019050919050565b60006020820190508181036000830152611c8481611c48565b9050919050565b7f5369676e61747572652065787069726564000000000000000000000000000000600082015250565b6000611cc1601183611764565b9150611ccc82611c8b565b602082019050919050565b60006020820190508181036000830152611cf081611cb4565b9050919050565b7f496e73756666696369656e74207061796d656e74000000000000000000000000600082015250565b6000611d2d601483611764565b9150611d3882611cf7565b602082019050919050565b60006020820190508181036000830152611d5c81611d20565b9050919050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000611d99601183611764565b9150611da482611d63565b602082019050919050565b60006020820190508181036000830152611dc881611d8c565b9050919050565b600081905092915050565b6000611de68385611dcf565b9350611df38385846118ca565b82840190509392505050565b6000611e0c828486611dda565b91508190509392505050565b7f5369676e617475726520616c72656164792070726f6365737365640000000000600082015250565b6000611e4e601b83611764565b9150611e5982611e18565b602082019050919050565b60006020820190508181036000830152611e7d81611e41565b9050919050565b600082825260208201905092915050565b6000611ea18385611e84565b9350611eae8385846118ca565b611eb7836117a8565b840190509392505050565b60006020820190508181036000830152611edd818486611e95565b90509392505050565b6000606082019050611efb60008301866116a0565b611f0860208301856116a0565b611f15604083018461166c565b949350505050565b611f26816116ca565b8114611f3157600080fd5b50565b600081519050611f4381611f1d565b92915050565b600060208284031215611f5f57611f5e6115d7565b5b6000611f6d84828501611f34565b91505092915050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611fd2602683611764565b9150611fdd82611f76565b604082019050919050565b6000602082019050818103600083015261200181611fc5565b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b600061203e601483611764565b915061204982612008565b602082019050919050565b6000602082019050818103600083015261206d81612031565b9050919050565b7f556e737570706f72746564207369676e6174757265206c656e67746800000000600082015250565b60006120aa601c83611764565b91506120b582612074565b602082019050919050565b600060208201905081810360008301526120d98161209d565b9050919050565b6000819050919050565b6120fb6120f682611696565b6120e0565b82525050565b60008160601b9050919050565b600061211982612101565b9050919050565b600061212b8261210e565b9050919050565b61214361213e82611601565b612120565b82525050565b600061215582876120ea565b60208201915061216582866120ea565b6020820191506121758285612132565b60148201915061218582846120ea565b60208201915081905095945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b60006121fc601883611764565b9150612207826121c6565b602082019050919050565b6000602082019050818103600083015261222b816121ef565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000612268601f83611764565b915061227382612232565b602082019050919050565b600060208201905081810360008301526122978161225b565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006122fa602283611764565b91506123058261229e565b604082019050919050565b60006020820190508181036000830152612329816122ed565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061238c602283611764565b915061239782612330565b604082019050919050565b600060208201905081810360008301526123bb8161237f565b9050919050565b6000819050919050565b6123d5816123c2565b82525050565b600060ff82169050919050565b6123f1816123db565b82525050565b600060808201905061240c60008301876123cc565b61241960208301866123e8565b61242660408301856123cc565b61243360608301846123cc565b9594505050505056fea264697066735822122052dde2a1eb90854bca18d214c378e4ed5765fa4c8ace3fdfac3b89afb54c4a7c64736f6c634300080a0033

Verified Source Code Full Match

Compiler: v0.8.10+commit.fc410830 EVM: london Optimization: No
PoapBridge.sol 224 lines
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

/**
* @dev Interface to interact with POAP contract
* - Limited functionality as needed
**/
interface IPoap {
    function mintToken(uint256 eventId, uint256 tokenId, address to) external returns (bool);

    function renounceAdmin() external;
}

/**
 * @title POAP Bridge contract
 * @dev Migrate POAP from the main chain to a secondary chain
 * - Users can:
 *   # Set migration fee
 *   # Set migration fee receiver
 *   # Renounce as Admin of POAP contract
 *   # Migrate a POAP
 *   # Pause contract if admin
 *   # Unpause contract if admin
 * @author POAP
 * - Developers:
 *   # Agustin Lavarello
 *   # Rodrigo Manuel Navarro Lajous
 *   # Ramiro Gonzales
**/
contract PoapBridge is Ownable, Pausable {

    /**
     * @dev Emitted when signature is verified
     */
    event VerifiedSignature(
        bytes _signature
    );

    /**
     * @dev Emitted when the signer changes
     */
    event ValidSignerChange(
        address indexed previousValidSigner,
        address indexed newValidSigner
    );

    /**
     * @dev Emitted when the fee receiver changes
     */
    event FeeReceiverChange(
        address indexed previousFeeReceiver,
        address indexed newFeeReceiver
    );

    /**
     * @dev Emitted when the migration fee changes
     */
    event MigrationFeeChange(
        uint256 indexed previousFeeReceiver,
        uint256 indexed newFeeReceiver
    );

    using ECDSA for bytes32;

    // Name of the contract
    string public constant NAME = "POAP Bridge";

    // Interface to interact with POAP contract
    // solhint-disable-next-line var-name-mixedcase
    IPoap immutable private POAPToken;

    // POAP valid token minter
    address public validSigner;

    // POAP fee receiver
    address payable public feeReceiver;

    // POAP fee
    uint256 public migrationFee;

    // Processed signatures
    mapping(bytes => bool) public processed;

    constructor (
        address _poapContractAddress,
        address _validSigner,
        address payable _feeReceiver,
        uint256 _migrationFee
    ) {
        require(_validSigner != address(0), "The zero address can't be a valid signer");
        validSigner = _validSigner;
        POAPToken = IPoap(_poapContractAddress);
        feeReceiver = _feeReceiver;
        migrationFee = _migrationFee;
    }
    
    /**
     * @dev Called by the owner to pause, triggers stopped state.
     * Requires 
     * - The msg sender to be the owner
     */
    function pause() external onlyOwner {
        _pause();
    }

     /**
     * @dev Called by the owner to pause, triggers unstopped state.
     * Requires 
     * - The msg sender to be the owner
     */
    function unpause() external onlyOwner {
        _unpause();
    }

    /**
     * @dev Sets address that will receive the migration fee
     * Requires 
     * - The msg sender to be the owner
     * @param _feeReceiver ( address payable ) The address that will receive the fee
     */
    function setFeeReceiver(address payable _feeReceiver) external onlyOwner {
        address oldFeeReceiver = feeReceiver;
        feeReceiver = _feeReceiver;
        emit FeeReceiverChange(oldFeeReceiver, _feeReceiver);
    }

    /**
     * @dev Sets address fee to be charged for migration
     * Requires 
     * - The msg sender to be the owner
     * @param _migrationFee ( uint256 ) The amount of wei to charge
     */
    function setMigrationFee(uint256 _migrationFee) external onlyOwner {
        uint256 oldMigrationFee = migrationFee;
        migrationFee = _migrationFee;
        emit MigrationFeeChange(oldMigrationFee, _migrationFee);
    }

    /**
     * @dev Sets valid signer, the signer can sign the message to migrate a poap
     * Requires
     * - The msg sender to be the owner
     * - The _validSigner not to be the zero address
     * @param _validSigner ( address ) The new valid signer
     */
    function setValidSigner(address _validSigner) external onlyOwner {
        require(_validSigner != address(0), "The zero address can't be a valid signer");
        address oldValidSigner = validSigner;
        validSigner = _validSigner;
        emit ValidSignerChange(oldValidSigner, _validSigner);
    }

    /**
     * @dev Function to renounce as Admin in POAP contract
     * Requires 
     * - The msg sender to be the owner
     */
    function renouncePoapAdmin() external onlyOwner {
        POAPToken.renounceAdmin();
    }

    /**
     * @dev Function to verify signature
     * @param _eventId ( uint256 ) EventId for the token
     * @param _tokenId ( uint256 ) The token id to mint.
     * @param _receiver ( address ) The address that will receive the minted tokens.
     * @param _expirationTime ( uint256 ) Token expiration time.
     * @param _signature ( bytes ) Signature of the message digest.
     * @return A boolean that indicates if the signature is valid.
     */
    function isValidSignature(
        uint256 _eventId,
        uint256 _tokenId,
        address _receiver,
        uint256 _expirationTime,
        bytes memory _signature
    ) private view returns(bool) {
        require(_signature.length == 65, "Unsupported signature length");
        bytes32 message = keccak256(abi.encodePacked(_eventId, _tokenId, _receiver, _expirationTime));
        return message.recover(_signature) == validSigner;
    }

    /**
     * @dev Function to mint tokens
     * Requires 
     * - The sender to send value equal to or greater than the fee
     * - The contract must not be paused
     * @param eventId ( uint256 ) EventId for the token
     * @param tokenId ( uint256 ) The token id to mint.
     * @param receiver ( address ) The address that will receive the minted tokens.
     * @param expirationTime ( uint256 ) Token expiration time.
     * @param signature ( bytes ) Signature of the message digest.
     * @return A boolean that indicates if the operation was successful.
     */
    function mintToken(
        uint256 eventId,
        uint256 tokenId,
        address receiver,
        uint256 expirationTime,
        bytes calldata signature
    ) external payable whenNotPaused returns (bool) {
        // Check that the timestamp hasn't expired
        // solhint-disable-next-line not-rely-on-time
        require(block.timestamp < expirationTime, "Signature expired");
        // Check that the user pay the migration fee
        require(msg.value >= migrationFee, "Insufficient payment");
        // Check that the signature is valid
        require(isValidSignature(eventId, tokenId, receiver, expirationTime, signature), "Invalid signature");
        // Check that the signature was not already processed
        require(processed[signature] == false, "Signature already processed");

        processed[signature] = true;

        // Send the message value to the receiver
        feeReceiver.transfer(msg.value);

        emit VerifiedSignature(signature);
        return POAPToken.mintToken(eventId, tokenId, receiver);
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
ECDSA.sol 234 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

Read Contract

NAME 0xa3f4df7e → string
feeReceiver 0xb3f00674 → address
migrationFee 0x46dcab55 → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
processed 0xac13e2cf → bool
validSigner 0x1cc7d743 → address

Write Contract 9 functions

These functions modify contract state and require a wallet transaction to execute.

mintToken 0xaf68b302
uint256 eventId
uint256 tokenId
address receiver
uint256 expirationTime
bytes signature
returns: bool
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
renouncePoapAdmin 0x25e59976
No parameters
setFeeReceiver 0xefdcd974
address _feeReceiver
setMigrationFee 0x66f20b4f
uint256 _migrationFee
setValidSigner 0x12d8b659
address _validSigner
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters

Recent Transactions

No transactions found for this address