My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x315c7faf16140cb8a1cad273fd88c4de5a540e0e87ad8f5ab8bce64d4b40fa36 | 0x60806040 | 21291982 | 572 days 11 hrs ago | 0x13be18cee264d1bda8ed618a4b5d836ceca871ea | IN | Create: WMaticWrapBridge | 0 MATIC | 0.00764052 |
[ Download CSV Export ]
OVERVIEW
DeFi Basket's auxiliar contract for communication with WMatic.Contract Name:
WMaticWrapBridge
Compiler Version
v0.8.6+commit.11564f7e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IWMatic.sol"; import "../../interfaces/IWMaticWrap.sol"; /** * @title QuickswapSwapBridge * @author DeFi Basket * * @notice Swaps using the Quickswap contract in Polygon. * * @dev This contract swaps ERC20 tokens to ERC20 tokens. Please notice that there are no payable functions. * */ contract WMaticWrapBridge is IWMaticWrap { address constant wMaticAddress = 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270; IWMatic constant wmatic = IWMatic(wMaticAddress); /** * @notice Wraps MATIC to WMATIC * * @dev Wraps MATIC into WMATIC using the WMATIC contract. * * @param percentageIn Percentage of MATIC to be wrapped into WMATIC */ function wrap(uint256 percentageIn) external override { emit DEFIBASKET_WMATIC_WRAP(address(this).balance * percentageIn / 100000); wmatic.deposit{value : address(this).balance * percentageIn / 100000}(); } /** * @notice Unwraps WMATIC to MATIC * * @dev Unwraps WMATIC into MATIC using the WMATIC contract. * * @param percentageOut Percentage of WMATIC to be unwrapped into MATIC */ function unwrap(uint256 percentageOut) external override { emit DEFIBASKET_WMATIC_UNWRAP(IERC20(wMaticAddress).balanceOf(address(this)) * percentageOut / 100000); wmatic.withdraw(IERC20(wMaticAddress).balanceOf(address(this)) * percentageOut / 100000); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; interface IWMatic { function deposit() external payable; function withdraw(uint wad) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; interface IWMaticWrap { event DEFIBASKET_WMATIC_WRAP ( uint256 amountIn ); event DEFIBASKET_WMATIC_UNWRAP ( uint256 amountOut ); function wrap(uint256 percentageIn) external; function unwrap(uint256 percentageOut) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"DEFIBASKET_WMATIC_UNWRAP","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"DEFIBASKET_WMATIC_WRAP","type":"event"},{"inputs":[{"internalType":"uint256","name":"percentageOut","type":"uint256"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"percentageIn","type":"uint256"}],"name":"wrap","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506103a5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063de0e9a3e1461003b578063ea598cb014610050575b600080fd5b61004e6100493660046102ee565b610063565b005b61004e61005e3660046102ee565b61022b565b6040516370a0823160e01b81523060048201527f0e7a45cee7c9b68469582abe8d7a182713fb9bbecf4a917c328834621d6d5c2490620186a0908390730d500b1d8e8ef31e21c99d1db9a6444d3adf1270906370a082319060240160206040518083038186803b1580156100d657600080fd5b505afa1580156100ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061010e9190610307565b6101189190610342565b6101229190610320565b60405190815260200160405180910390a16040516370a0823160e01b8152306004820152730d500b1d8e8ef31e21c99d1db9a6444d3adf127090632e1a7d4d90620186a090849084906370a082319060240160206040518083038186803b15801561018c57600080fd5b505afa1580156101a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c49190610307565b6101ce9190610342565b6101d89190610320565b6040518263ffffffff1660e01b81526004016101f691815260200190565b600060405180830381600087803b15801561021057600080fd5b505af1158015610224573d6000803e3d6000fd5b5050505050565b7f4e158433c89a8fae5b4a89fdbde9018f5a3401d10acf71bc77bf6117cfa4cfdb620186a061025a8347610342565b6102649190610320565b60405190815260200160405180910390a1730d500b1d8e8ef31e21c99d1db9a6444d3adf127063d0e30db0620186a061029d8447610342565b6102a79190610320565b6040518263ffffffff1660e01b81526004016000604051808303818588803b1580156102d257600080fd5b505af11580156102e6573d6000803e3d6000fd5b505050505050565b60006020828403121561030057600080fd5b5035919050565b60006020828403121561031957600080fd5b5051919050565b60008261033d57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561036a57634e487b7160e01b600052601160045260246000fd5b50029056fea26469706673582212204bf7a26c5ef0f2b36650580147e2cd69d1b375e535c6f099f8aad82d727a2df564736f6c63430008060033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.