Blocks
Blocks
Uncles
Forked Blocks (Reorgs)
Transactions
Validated
Pending
Tokens
All
NRG
APIs
GraphQL
RPC
NRG RPC
Mainnet
Mainnets
Testnets
Other Networks
/
Search
/
Search
Connection Lost
New Vyper Smart Contract Verification
Contract Address
The 0x address supplied on contract creation.
Contract Name
Must match the name specified in the code.
Compiler
latest
v0.4.1b1
v0.4.0rc6
v0.4.0rc5
v0.4.0rc4
v0.4.0rc3
v0.4.0rc2
v0.4.0rc1
v0.4.0b6
v0.4.0b5
v0.4.0b4
v0.4.0b3
v0.4.0b2
v0.4.0b1
v0.3.10rc5
v0.3.10rc4
v0.3.10rc3
v0.3.10rc2
v0.3.10rc1
v0.3.10
v0.3.9
v0.3.8
v0.3.7
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.4.0
v0.3.0
Enter the Vyper Contract Code
// File: ../energiswapPairsManager/IEnergiswapPairsManager.sol // Copyright (C) 2020 Energi Core // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity >=0.5.0; interface IEnergiswapPairsManager { event Mint(address indexed pair, address indexed sender, uint amount0, uint amount1, address indexed to); event Burn(address indexed pair, address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(address indexed sender, uint112 reserve0, uint112 reserve1); function _storage() external view returns (address); function destroy(address _newImpl) external; function migrate(address _oldImpl) external; function registerPair(address _pairProxy, address _pairStorage, address _erc20Storage) external; function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function approve(address spender, uint value) external returns (bool result); function transfer(address to, uint value) external returns (bool result); function transferFrom(address from, address to, uint value) external returns (bool result); function redeemLiquidity(address router, address owner, uint value) external returns (bool result); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; function emitApproval(address pair, address owner, address spender, uint value) external; function emitTransfer(address pair, address from, address to, uint value) external; function factory() external view returns (address _factory); function getReserves(address pair) external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast); function token0(address pair) external view returns (address _token0); function token1(address pair) external view returns (address _token1); function price0CumulativeLast(address pair) external view returns (uint _price0CumulativeLast); function price1CumulativeLast(address pair) external view returns (uint _price1CumulativeLast); function kLast(address pair) external view returns (uint _kLast); } // File: IEnergiswapPairProxy.sol // Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Energi Core is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Energi Core. If not, see <http://www.gnu.org/licenses/>. // Energi Governance system is the fundamental part of Energi Core. // NOTE: It's not allowed to change the compiler due to byte-to-byte // match requirement. pragma solidity >=0.5.0; /** * Genesis version of IGovernedProxy interface. * * Base Consensus interface for upgradable contracts proxy. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */ interface IEnergiswapPairProxy { function pairsManagerProxy() external view returns (address); function pairsERC20Proxy() external view returns (address); function routerProxy() external view returns (address); function emitMint(address sender, uint amount0, uint amount1, address to) external; function emitBurn(address sender, uint amount0, uint amount1, address to) external; function emitSwap(address sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address to) external; function emitSync(uint112 reserve0, uint112 reserve1) external; function emitApproval(address owner, address spender, uint value) external; function emitTransfer(address from, address to, uint value) external; function safeTransfer(address token, address to, uint value, bytes4 SELECTOR) external; function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast); function token0() external view returns (address _token0); function token1() external view returns (address _token1); function price0CumulativeLast() external view returns (uint _price0CumulativeLast); function price1CumulativeLast() external view returns (uint _price1CumulativeLast); function kLast() external view returns (uint _kLast); function name() external view returns(string memory _name); function symbol() external view returns(string memory _symbol); function decimals() external view returns(uint8 _decimals); function totalSupply() external view returns (uint _totalSupply); function balanceOf(address account) external view returns (uint _balance); function allowance(address owner, address spender) external view returns (uint _allowance); function nonce(address owner) external view returns(uint _nonce); function () external payable; } // File: ../energiswapPairsERC20/IEnergiswapPairsERC20.sol // Copyright (C) 2020 Energi Core // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity >=0.5.0; interface IEnergiswapPairsERC20 { function initialized() external view returns (bool); function _storage() external view returns (address); event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function initialize(address _pairsManagerProxy) external; function destroy(address _newImpl) external; function migrate(address _oldImpl) external; function registerPair(address _pairProxy, address _erc20Storage) external; function _mint(address pair, address to, uint value) external; function _burn(address pair, address from, uint value) external; function approve(address pair, address owner, address spender, uint value) external returns (bool); function transfer(address pair, address from, address to, uint value) external returns (bool); function transferFrom(address pair, address spender, address from, address to, uint value) external returns (bool); function permit(address pair, address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; function nonce(address pair, address owner) external view returns(uint _nonce); function name() external view returns(string memory _name); function symbol() external view returns(string memory _symbol); function decimals() external view returns(uint8 _decimals); function totalSupply(address pair) external view returns (uint _totalSupply); function balanceOf(address pair, address account) external view returns (uint _balance); function allowance(address pair, address owner, address spender) external view returns (uint _allowance); } // File: ../interfaces/IGovernedContract.sol // Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Energi Core is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Energi Core. If not, see <http://www.gnu.org/licenses/>. // Energi Governance system is the fundamental part of Energi Core. // NOTE: It's not allowed to change the compiler due to byte-to-byte // match requirement. /** * Genesis version of GovernedContract interface. * * Base Consensus interface for upgradable contracts. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */ interface IGovernedContract { // Return actual proxy address for secure validation function proxy() external returns(address); // It must check that the caller is the proxy // and copy all required data from the old address. function migrate(IGovernedContract _oldImpl) external; // It must check that the caller is the proxy // and self destruct to the new address. function destroy(IGovernedContract _newImpl) external; // function () external payable; // This line (from original Energi IGovernedContract) is commented because it // makes truffle migrations fail } // File: ../interfaces/IProposal.sol // Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Energi Core is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Energi Core. If not, see <http://www.gnu.org/licenses/>. // Energi Governance system is the fundamental part of Energi Core. // NOTE: It's not allowed to change the compiler due to byte-to-byte // match requirement. pragma solidity >=0.5.0; interface IProposal { function parent() external view returns(address); function created_block() external view returns(uint); function deadline() external view returns(uint); function fee_payer() external view returns(address payable); function fee_amount() external view returns(uint); function accepted_weight() external view returns(uint); function rejected_weight() external view returns(uint); function total_weight() external view returns(uint); function quorum_weight() external view returns(uint); function isFinished() external view returns(bool); function isAccepted() external view returns(bool); function withdraw() external; function destroy() external; function collect() external; function voteAccept() external; function voteReject() external; function setFee() external payable; function canVote(address owner) external view returns(bool); } // File: ../interfaces/IUpgradeProposal.sol // Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Energi Core is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Energi Core. If not, see <http://www.gnu.org/licenses/>. // Energi Governance system is the fundamental part of Energi Core. // NOTE: It's not allowed to change the compiler due to byte-to-byte // match requirement. pragma solidity >=0.5.0; /** * Interface of UpgradeProposal */ contract IUpgradeProposal is IProposal { function impl() external view returns(IGovernedContract); } // File: ../interfaces/IGovernedProxy.sol // Copyright 2019 The Energi Core Authors // This file is part of Energi Core. // // Energi Core is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Energi Core is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Energi Core. If not, see <http://www.gnu.org/licenses/>. // Energi Governance system is the fundamental part of Energi Core. // NOTE: It's not allowed to change the compiler due to byte-to-byte // match requirement. pragma solidity >=0.5.0; //pragma experimental SMTChecker; /** * Genesis version of IGovernedProxy interface. * * Base Consensus interface for upgradable contracts proxy. * Unlike common approach, the implementation is NOT expected to be * called through delegatecall() to minimize risks of shared storage. * * NOTE: it MUST NOT change after blockchain launch! */ interface IGovernedProxy { event UpgradeProposal( IGovernedContract indexed impl, IUpgradeProposal proposal ); event Upgraded( IGovernedContract indexed impl, IUpgradeProposal proposal ); function impl() external view returns(IGovernedContract); function proposeUpgrade(IGovernedContract _newImpl, uint _period) external payable returns(IUpgradeProposal); function upgrade(IUpgradeProposal _proposal) external; function upgradeProposalImpl(IUpgradeProposal _proposal) external view returns(IGovernedContract new_impl); function listUpgradeProposals() external view returns(IUpgradeProposal[] memory proposals); function collectUpgradeProposal(IUpgradeProposal _proposal) external; function () external payable; } // File: EnergiswapPairProxy.sol // Copyright (C) 2020 Energi Core // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity = 0.5.16; /** * SC-9: This contract has no chance of being updated. It must be stupid simple. * * If another upgrade logic is required in the future - it can be done as proxy stage II. */ contract EnergiswapPairProxy is IEnergiswapPairProxy { address public pairsManagerProxy; address public pairsERC20Proxy; address public routerProxy; function pairsManager() private view returns(address _pairsManager) { _pairsManager = address(IGovernedProxy(address(uint160(pairsManagerProxy))).impl()); } function pairsERC20() private view returns(address _pairsERC20) { _pairsERC20 = address(IGovernedProxy(address(uint160(pairsERC20Proxy))).impl()); } function router() private view returns(address _router) { _router = address(IGovernedProxy(address(uint160(routerProxy))).impl()); } modifier senderOrigin { // solium-disable-next-line security/no-tx-origin require( tx.origin == msg.sender || msg.sender == router(), "EnergiswapPairGovernedProxy: FORBIDDEN, not a direct call or a call from router"); _; } modifier requireManager { require(msg.sender == pairsManager(), "EnergiswapPairGovernedProxy: FORBIDDEN, not pairsManager"); _; } event Mint(address indexed sender, uint amount0, uint amount1, address indexed to); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor(address _routerProxy, address _pairsManagerProxy, address _pairsERC20Proxy) public { routerProxy = _routerProxy; pairsManagerProxy = _pairsManagerProxy; pairsERC20Proxy = _pairsERC20Proxy; } // Emit Mint event function emitMint(address sender, uint amount0, uint amount1, address to) external requireManager { emit Mint(sender, amount0, amount1, to); } // Emit Burn event function emitBurn(address sender, uint amount0, uint amount1, address to) external requireManager { emit Burn(sender, amount0, amount1, to); } // Emit Swap event function emitSwap(address sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address to) external requireManager { emit Swap(sender, amount0In, amount1In, amount0Out, amount1Out, to); } // Emit Sync event function emitSync(uint112 reserve0, uint112 reserve1) external requireManager { emit Sync(reserve0, reserve1); } // Emit Approval event function emitApproval(address owner, address spender, uint value) external requireManager { emit Approval(owner, spender, value); } // Emit Transfer event function emitTransfer(address from, address to, uint value) external requireManager { emit Transfer(from, to, value); } // EnergiswapPairGovernedProxy holds pair assets. This function can be called by EnegiswapPairsManager to transfer funds function safeTransfer(address token, address to, uint value, bytes4 SELECTOR) external requireManager { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'EnergiswapPairGovernedProxy: TRANSFER_FAILED'); } // Expose Pair getter functions function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { (_reserve0, _reserve1, _blockTimestampLast) = IEnergiswapPairsManager(pairsManager()).getReserves(address(this)); } function token0() external view returns (address _token0) { _token0 = IEnergiswapPairsManager(pairsManager()).token0(address(this)); } function token1() external view returns (address _token1) { _token1 = IEnergiswapPairsManager(pairsManager()).token1(address(this)); } function price0CumulativeLast() external view returns (uint _price0CumulativeLast) { _price0CumulativeLast = IEnergiswapPairsManager(pairsManager()).price0CumulativeLast(address(this)); } function price1CumulativeLast() external view returns (uint _price1CumulativeLast) { _price1CumulativeLast = IEnergiswapPairsManager(pairsManager()).price1CumulativeLast(address(this)); } function kLast() external view returns (uint _kLast) { _kLast = IEnergiswapPairsManager(pairsManager()).kLast(address(this)); } // Expose ERC20 getter functions function name() external view returns(string memory _name) { _name = IEnergiswapPairsERC20(pairsERC20()).name(); } function symbol() external view returns(string memory _symbol) { _symbol = IEnergiswapPairsERC20(pairsERC20()).symbol(); } function decimals() external view returns(uint8 _decimals) { _decimals = IEnergiswapPairsERC20(pairsERC20()).decimals(); } function totalSupply() external view returns (uint _totalSupply) { _totalSupply = IEnergiswapPairsERC20(pairsERC20()).totalSupply(address(this)); } function balanceOf(address account) external view returns (uint _balance) { _balance = IEnergiswapPairsERC20(pairsERC20()).balanceOf(address(this), account); } function allowance(address owner, address spender) external view returns (uint _allowance) { _allowance = IEnergiswapPairsERC20(pairsERC20()).allowance(address(this), owner, spender); } function nonce(address owner) external view returns(uint _nonce) { _nonce = IEnergiswapPairsERC20(pairsERC20()).nonce(address(this), owner); } /** * Proxy all other calls to pairsManager. */ function () external payable senderOrigin { // SECURITY: senderOrigin() modifier is mandatory IEnergiswapPairsManager _pairsManager = IEnergiswapPairsManager(pairsManager()); // solium-disable-next-line security/no-inline-assembly assembly { let ptr := mload(0x40) calldatacopy(ptr, 0, calldatasize()) let res := call(sub(gas(), 10000), _pairsManager, callvalue(), ptr, calldatasize(), 0, 0) // NOTE: returndatasize should allow repeatable calls // what should save one opcode. returndatacopy(ptr, 0, returndatasize()) switch res case 0 { revert(ptr, returndatasize()) } default { return(ptr, returndatasize()) } } } }
ABI-encoded Constructor Arguments (if required by the contract)
Add arguments in
ABI hex encoded form
. Constructor arguments are written right to left, and will be found at the end of the input created bytecode. They may also be
parsed here.
Loading...
Verify & publish
Cancel
Ok
Ok
Ok
No
Yes