More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 9,512 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Lock Assets | 19138555 | 354 days ago | IN | 0 ETH | 0.00100209 | ||||
Lock Assets | 19095315 | 360 days ago | IN | 0 ETH | 0.00105517 | ||||
Lock Assets | 19095269 | 360 days ago | IN | 0 ETH | 0.00089044 | ||||
Lock Assets | 19095163 | 360 days ago | IN | 0 ETH | 0.00076827 | ||||
Lock Assets | 16407881 | 737 days ago | IN | 0 ETH | 0.00196022 | ||||
Lock Assets | 16407871 | 737 days ago | IN | 0 ETH | 0.00212626 | ||||
Lock Assets | 16407863 | 737 days ago | IN | 0 ETH | 0.00278312 | ||||
Lock Assets | 16407855 | 737 days ago | IN | 0 ETH | 0.00154653 | ||||
Lock Assets | 16280288 | 755 days ago | IN | 0 ETH | 0.00104854 | ||||
Lock Assets | 16072511 | 784 days ago | IN | 0 ETH | 0.00064288 | ||||
Submit VAA | 15419833 | 878 days ago | IN | 0 ETH | 0.00145329 | ||||
Submit VAA | 15419600 | 878 days ago | IN | 0 ETH | 0.00117208 | ||||
Submit VAA | 15156325 | 919 days ago | IN | 0 ETH | 0.00390255 | ||||
Lock Assets | 15156213 | 919 days ago | IN | 0 ETH | 0.00210535 | ||||
Submit VAA | 15150742 | 920 days ago | IN | 0 ETH | 0.00178819 | ||||
Submit VAA | 15150722 | 920 days ago | IN | 0 ETH | 0.0019716 | ||||
Submit VAA | 15045431 | 936 days ago | IN | 0 ETH | 0.01712557 | ||||
Submit VAA | 15041016 | 937 days ago | IN | 0 ETH | 0.01436317 | ||||
Submit VAA | 15040722 | 937 days ago | IN | 0 ETH | 0.0145222 | ||||
Submit VAA | 15040697 | 937 days ago | IN | 0 ETH | 0.01966319 | ||||
Submit VAA | 15040685 | 937 days ago | IN | 0 ETH | 0.0131182 | ||||
Submit VAA | 15040680 | 937 days ago | IN | 0 ETH | 0.01239882 | ||||
Submit VAA | 15040657 | 937 days ago | IN | 0 ETH | 0.01381616 | ||||
Submit VAA | 15040644 | 937 days ago | IN | 0 ETH | 0.01275499 | ||||
Submit VAA | 15040627 | 937 days ago | IN | 0 ETH | 0.01261219 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
19138555 | 354 days ago | 0 ETH | |||||
19138555 | 354 days ago | 0 ETH | |||||
19138555 | 354 days ago | 0 ETH | |||||
19138555 | 354 days ago | 0 ETH | |||||
19138555 | 354 days ago | 0 ETH | |||||
19095315 | 360 days ago | 0 ETH | |||||
19095315 | 360 days ago | 0 ETH | |||||
19095315 | 360 days ago | 0 ETH | |||||
19095315 | 360 days ago | 0 ETH | |||||
19095315 | 360 days ago | 0 ETH | |||||
19095269 | 360 days ago | 0 ETH | |||||
19095269 | 360 days ago | 0 ETH | |||||
19095269 | 360 days ago | 0 ETH | |||||
19095269 | 360 days ago | 0 ETH | |||||
19095269 | 360 days ago | 0 ETH | |||||
19095163 | 360 days ago | 0 ETH | |||||
19095163 | 360 days ago | 0 ETH | |||||
19095163 | 360 days ago | 0 ETH | |||||
19095163 | 360 days ago | 0 ETH | |||||
19095163 | 360 days ago | 0 ETH | |||||
16407881 | 737 days ago | 0 ETH | |||||
16407881 | 737 days ago | 0 ETH | |||||
16407881 | 737 days ago | 0 ETH | |||||
16407881 | 737 days ago | 0 ETH | |||||
16407881 | 737 days ago | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Wormhole
Compiler Version
v0.6.12+commit.27d51765
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// contracts/Wormhole.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./BytesLib.sol"; import "./WrappedAsset.sol"; contract Wormhole is ReentrancyGuard { using SafeERC20 for IERC20; using BytesLib for bytes; using SafeMath for uint256; uint64 constant MAX_UINT64 = 18_446_744_073_709_551_615; // Address of the Wrapped asset template address public wrappedAssetMaster; // Chain ID of Ethereum uint8 CHAIN_ID = 2; // Address of the official WETH contract address constant WETHAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; struct GuardianSet { address[] keys; uint32 expiration_time; } event LogGuardianSetChanged( uint32 oldGuardianIndex, uint32 newGuardianIndex ); event LogTokensLocked( uint8 target_chain, uint8 token_chain, uint8 token_decimals, bytes32 indexed token, bytes32 indexed sender, bytes32 recipient, uint256 amount, uint32 nonce ); struct ParsedVAA { uint8 version; bytes32 hash; uint32 guardian_set_index; uint32 timestamp; uint8 action; bytes payload; } // Mapping of guardian_set_index => guardian set mapping(uint32 => GuardianSet) public guardian_sets; // Current active guardian set uint32 public guardian_set_index; // Period for which a guardian set stays active after it has been replaced uint32 public guardian_set_expirity; // Mapping of already consumedVAAs mapping(bytes32 => bool) public consumedVAAs; // Mapping of wrapped asset ERC20 contracts mapping(bytes32 => address) public wrappedAssets; mapping(address => bool) public isWrappedAsset; constructor(GuardianSet memory initial_guardian_set, address wrapped_asset_master, uint32 _guardian_set_expirity) public { guardian_sets[0] = initial_guardian_set; // Explicitly set for doc purposes guardian_set_index = 0; guardian_set_expirity = _guardian_set_expirity; wrappedAssetMaster = wrapped_asset_master; } function getGuardianSet(uint32 idx) view public returns (GuardianSet memory gs) { return guardian_sets[idx]; } function submitVAA( bytes calldata vaa ) public nonReentrant { ParsedVAA memory parsed_vaa = parseAndVerifyVAA(vaa); // Process VAA if (parsed_vaa.action == 0x01) { require(parsed_vaa.guardian_set_index == guardian_set_index, "only the current guardian set can change the guardian set"); vaaUpdateGuardianSet(parsed_vaa.payload); } else if (parsed_vaa.action == 0x10) { vaaTransfer(parsed_vaa.payload); } else { revert("invalid VAA action"); } // Set the VAA as consumed consumedVAAs[parsed_vaa.hash] = true; } // parseAndVerifyVAA parses raw VAA data into a struct and verifies whether it contains sufficient signatures of an // active guardian set i.e. is valid according to Wormhole consensus rules. function parseAndVerifyVAA(bytes calldata vaa) public view returns (ParsedVAA memory parsed_vaa) { parsed_vaa.version = vaa.toUint8(0); require(parsed_vaa.version == 1, "VAA version incompatible"); // Load 4 bytes starting from index 1 parsed_vaa.guardian_set_index = vaa.toUint32(1); uint256 len_signers = vaa.toUint8(5); uint offset = 6 + 66 * len_signers; // Load 4 bytes timestamp parsed_vaa.timestamp = vaa.toUint32(offset); // Hash the body parsed_vaa.hash = keccak256(vaa.slice(offset, vaa.length - offset)); require(!consumedVAAs[parsed_vaa.hash], "VAA was already executed"); GuardianSet memory guardian_set = guardian_sets[parsed_vaa.guardian_set_index]; require(guardian_set.keys.length > 0, "invalid guardian set"); require(guardian_set.expiration_time == 0 || guardian_set.expiration_time > block.timestamp, "guardian set has expired"); // We're using a fixed point number transformation with 1 decimal to deal with rounding. require(((guardian_set.keys.length * 10 / 3) * 2) / 10 + 1 <= len_signers, "no quorum"); int16 last_index = - 1; for (uint i = 0; i < len_signers; i++) { uint8 index = vaa.toUint8(6 + i * 66); require(index > last_index, "signature indices must be ascending"); last_index = int16(index); bytes32 r = vaa.toBytes32(7 + i * 66); bytes32 s = vaa.toBytes32(39 + i * 66); uint8 v = vaa.toUint8(71 + i * 66); v += 27; require(ecrecover(parsed_vaa.hash, v, r, s) == guardian_set.keys[index], "VAA signature invalid"); } parsed_vaa.action = vaa.toUint8(offset + 4); parsed_vaa.payload = vaa.slice(offset + 5, vaa.length - (offset + 5)); } function vaaUpdateGuardianSet(bytes memory data) private { uint32 new_guardian_set_index = data.toUint32(0); require(new_guardian_set_index == guardian_set_index + 1, "index must increase in steps of 1"); uint8 len = data.toUint8(4); address[] memory new_guardians = new address[](len); for (uint i = 0; i < len; i++) { address addr = data.toAddress(5 + i * 20); new_guardians[i] = addr; } uint32 old_guardian_set_index = guardian_set_index; guardian_set_index = new_guardian_set_index; GuardianSet memory new_guardian_set = GuardianSet(new_guardians, 0); guardian_sets[guardian_set_index] = new_guardian_set; guardian_sets[old_guardian_set_index].expiration_time = uint32(block.timestamp) + guardian_set_expirity; emit LogGuardianSetChanged(old_guardian_set_index, guardian_set_index); } function vaaTransfer(bytes memory data) private { //uint32 nonce = data.toUint64(0); uint8 source_chain = data.toUint8(4); uint8 target_chain = data.toUint8(5); //bytes32 source_address = data.toBytes32(6); //bytes32 target_address = data.toBytes32(38); address target_address = data.toAddress(38 + 12); uint8 token_chain = data.toUint8(70); //bytes32 token_address = data.toBytes32(71); uint256 amount = data.toUint256(104); require(source_chain != target_chain, "same chain transfers are not supported"); require(target_chain == CHAIN_ID, "transfer must be incoming"); if (token_chain != CHAIN_ID) { bytes32 token_address = data.toBytes32(71); bytes32 asset_id = keccak256(abi.encodePacked(token_chain, token_address)); // if yes: mint to address // if no: create and mint address wrapped_asset = wrappedAssets[asset_id]; if (wrapped_asset == address(0)) { uint8 asset_decimals = data.toUint8(103); wrapped_asset = deployWrappedAsset(asset_id, token_chain, token_address, asset_decimals); } WrappedAsset(wrapped_asset).mint(target_address, amount); } else { address token_address = data.toAddress(71 + 12); uint8 decimals = ERC20(token_address).decimals(); // Readjust decimals if they've previously been truncated if (decimals > 9) { amount = amount.mul(10 ** uint256(decimals - 9)); } IERC20(token_address).safeTransfer(target_address, amount); } } function deployWrappedAsset(bytes32 seed, uint8 token_chain, bytes32 token_address, uint8 decimals) private returns (address asset){ // Taken from https://github.com/OpenZeppelin/openzeppelin-sdk/blob/master/packages/lib/contracts/upgradeability/ProxyFactory.sol // Licensed under MIT bytes20 targetBytes = bytes20(wrappedAssetMaster); assembly { let clone := mload(0x40) mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(clone, 0x14), targetBytes) mstore(add(clone, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) asset := create2(0, clone, 0x37, seed) } // Call initializer WrappedAsset(asset).initialize(token_chain, token_address, decimals); // Store address wrappedAssets[seed] = asset; isWrappedAsset[asset] = true; } function lockAssets( address asset, uint256 amount, bytes32 recipient, uint8 target_chain, uint32 nonce, bool refund_dust ) public nonReentrant { require(target_chain != CHAIN_ID, "must not transfer to the same chain"); uint8 asset_chain = CHAIN_ID; bytes32 asset_address; uint8 decimals = ERC20(asset).decimals(); if (isWrappedAsset[asset]) { WrappedAsset(asset).burn(msg.sender, amount); asset_chain = WrappedAsset(asset).assetChain(); asset_address = WrappedAsset(asset).assetAddress(); } else { uint256 balanceBefore = IERC20(asset).balanceOf(address(this)); IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); uint256 balanceAfter = IERC20(asset).balanceOf(address(this)); // The amount that was transferred in is the delta between balance before and after the transfer. // This is to properly handle tokens that charge a fee on transfer. amount = balanceAfter.sub(balanceBefore); // Decimal adjust amount - we keep the dust if (decimals > 9) { uint256 original_amount = amount; amount = amount.div(10 ** uint256(decimals - 9)); if (refund_dust) { IERC20(asset).safeTransfer(msg.sender, original_amount.mod(10 ** uint256(decimals - 9))); } decimals = 9; } require(balanceAfter.div(10 ** uint256(ERC20(asset).decimals() - 9)) <= MAX_UINT64, "bridge balance would exceed maximum"); asset_address = bytes32(uint256(asset)); } // Check here after truncation require(amount != 0, "truncated amount must not be 0"); emit LogTokensLocked(target_chain, asset_chain, decimals, asset_address, bytes32(uint256(msg.sender)), recipient, amount, nonce); } function lockETH( bytes32 recipient, uint8 target_chain, uint32 nonce ) public payable nonReentrant { require(target_chain != CHAIN_ID, "must not transfer to the same chain"); uint256 remainder = msg.value.mod(10 ** 9); uint256 transfer_amount = msg.value.div(10 ** 9); require(transfer_amount != 0, "truncated amount must not be 0"); // Transfer back remainder msg.sender.transfer(remainder); // Wrap tx value in WETH WETH(WETHAddress).deposit{value : msg.value - remainder}(); // Log deposit of WETH emit LogTokensLocked(target_chain, CHAIN_ID, 9, bytes32(uint256(WETHAddress)), bytes32(uint256(msg.sender)), recipient, transfer_amount, nonce); } fallback() external payable {revert("please use lockETH to transfer ETH to Solana");} receive() external payable {revert("please use lockETH to transfer ETH to Solana");} } interface WETH is IERC20 { function deposit() external payable; function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.5.0 <0.7.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes_slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes_slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes_slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes_slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_bytes.length >= (_start + _length), "Read out of bounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= (_start + 20), "Read out of bounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= (_start + 1), "Read out of bounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= (_start + 2), "Read out of bounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= (_start + 4), "Read out of bounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= (_start + 8), "Read out of bounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= (_start + 12), "Read out of bounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= (_start + 16), "Read out of bounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= (_start + 32), "Read out of bounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= (_start + 32), "Read out of bounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes_slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes_slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// contracts/WrappedAsset.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.6.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/GSN/Context.sol"; contract WrappedAsset is IERC20, Context { uint8 public assetChain; bytes32 public assetAddress; bool public initialized; address public bridge; function initialize(uint8 _assetChain, bytes32 _assetAddress, uint8 decimals) public { require(!initialized, "already initialized"); // Set local fields assetChain = _assetChain; assetAddress = _assetAddress; bridge = msg.sender; initialized = true; _symbol = "WWT"; _decimals = decimals; } function mint(address account, uint256 amount) external { require(msg.sender == bridge, "mint can only be called by the bridge"); _mint(account, amount); } function burn(address account, uint256 amount) external { require(msg.sender == bridge, "burn can only be called by the bridge"); _burn(account, amount); } // Taken from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol // Licensed under MIT using SafeMath for uint256; using Address for address; mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _symbol; uint8 private _decimals = 18; /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return string(abi.encodePacked("Wormhole Wrapped - ", uintToString(assetChain), "-", assetAddressString())); } // https://ethereum.stackexchange.com/a/40977 function uintToString(uint _i) internal pure returns (string memory _uintAsString) { if (_i == 0) { return "0"; } uint j = _i; uint len; while (j != 0) { len++; j /= 10; } bytes memory bstr = new bytes(len); uint k = len - 1; while (_i != 0) { bstr[k--] = byte(uint8(48 + _i % 10)); _i /= 10; } return string(bstr); } // https://ethereum.stackexchange.com/a/58341 function assetAddressString() private view returns (string memory) { bytes memory alphabet = "0123456789abcdef"; bytes32 data = assetAddress; bytes memory str = new bytes(2 + data.length * 2); for (uint i = 0; i < data.length; i++) { str[i * 2] = alphabet[uint(uint8(data[i] >> 4))]; str[1 + i * 2] = alphabet[uint(uint8(data[i] & 0x0f))]; } return string(str); } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.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: MIT pragma solidity ^0.6.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.2; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return _functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); return _functionCallWithValue(target, data, value, errorMessage); } function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor () internal { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"address[]","name":"keys","type":"address[]"},{"internalType":"uint32","name":"expiration_time","type":"uint32"}],"internalType":"struct Wormhole.GuardianSet","name":"initial_guardian_set","type":"tuple"},{"internalType":"address","name":"wrapped_asset_master","type":"address"},{"internalType":"uint32","name":"_guardian_set_expirity","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"oldGuardianIndex","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"newGuardianIndex","type":"uint32"}],"name":"LogGuardianSetChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"target_chain","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"token_chain","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"token_decimals","type":"uint8"},{"indexed":true,"internalType":"bytes32","name":"token","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"sender","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"recipient","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"nonce","type":"uint32"}],"name":"LogTokensLocked","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"consumedVAAs","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"idx","type":"uint32"}],"name":"getGuardianSet","outputs":[{"components":[{"internalType":"address[]","name":"keys","type":"address[]"},{"internalType":"uint32","name":"expiration_time","type":"uint32"}],"internalType":"struct Wormhole.GuardianSet","name":"gs","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guardian_set_expirity","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"guardian_set_index","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"guardian_sets","outputs":[{"internalType":"uint32","name":"expiration_time","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWrappedAsset","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint8","name":"target_chain","type":"uint8"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"bool","name":"refund_dust","type":"bool"}],"name":"lockAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint8","name":"target_chain","type":"uint8"},{"internalType":"uint32","name":"nonce","type":"uint32"}],"name":"lockETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"vaa","type":"bytes"}],"name":"parseAndVerifyVAA","outputs":[{"components":[{"internalType":"uint8","name":"version","type":"uint8"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"uint32","name":"guardian_set_index","type":"uint32"},{"internalType":"uint32","name":"timestamp","type":"uint32"},{"internalType":"uint8","name":"action","type":"uint8"},{"internalType":"bytes","name":"payload","type":"bytes"}],"internalType":"struct Wormhole.ParsedVAA","name":"parsed_vaa","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"vaa","type":"bytes"}],"name":"submitVAA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wrappedAssetMaster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"wrappedAssets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040526001805460ff60a01b1916600160a11b1790553480156200002457600080fd5b50604051620028d4380380620028d48339810160408190526200004791620001b5565b600160009081558052600260209081528351805185927fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b92620000919284929190910190620000f7565b50602091909101516001918201805463ffffffff191663ffffffff928316179055600380546001600160401b03191664010000000094909216939093021790915580546001600160a01b0319166001600160a01b03929092169190911790555062000314565b8280548282559060005260206000209081019282156200014f579160200282015b828111156200014f57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000118565b506200015d92915062000161565b5090565b5b808211156200015d5780546001600160a01b031916815560010162000162565b80516001600160a01b03811681146200019a57600080fd5b92915050565b805163ffffffff811681146200019a57600080fd5b600080600060608486031215620001ca578283fd5b83516001600160401b0380821115620001e1578485fd5b9085019060408288031215620001f5578485fd5b620002016040620002d7565b82518281111562000210578687fd5b8301601f8101891362000221578687fd5b80518381111562000230578788fd5b6020935083810262000244858201620002d7565b8281528581019084870183860188018e10156200025f578b8cfd5b8b95505b848610156200028d57620002788e8262000182565b83526001959095019491870191870162000263565b508086525050505050620002a488838501620001a0565b818301529450620002b88787830162000182565b935050506040840151620002cc81620002fe565b809150509250925092565b6040518181016001600160401b0381118282101715620002f657600080fd5b604052919050565b63ffffffff811681146200031157600080fd5b50565b6125b080620003246000396000f3fe6080604052600436106100ab5760003560e01c8063707139601161006457806370713960146101c3578063822d82b3146101e357806399da1d3c146101f8578063a31fe4091461021a578063b6694c2a1461023a578063f951975a1461025a576100d1565b80631a2be4da146100e95780633bc0aee61461011f57806342b0aefa146101415780634db478401461016e57806358d62e4614610183578063600b9aa614610196576100d1565b366100d15760405162461bcd60e51b81526004016100c890611fb0565b60405180910390fd5b60405162461bcd60e51b81526004016100c890611fb0565b3480156100f557600080fd5b50610109610104366004611c59565b610287565b6040516101169190611ece565b60405180910390f35b34801561012b57600080fd5b5061013f61013a366004611d6b565b61029c565b005b34801561014d57600080fd5b5061016161015c366004611dd8565b610386565b60405161011691906124b1565b34801561017a57600080fd5b506101616103a1565b61013f610191366004611d2d565b6103b5565b3480156101a257600080fd5b506101b66101b1366004611d6b565b610559565b6040516101169190612452565b3480156101cf57600080fd5b5061013f6101de366004611c74565b610b43565b3480156101ef57600080fd5b50610161611045565b34801561020457600080fd5b5061020d611051565b6040516101169190611e7d565b34801561022657600080fd5b50610109610235366004611cfd565b611060565b34801561024657600080fd5b5061020d610255366004611cfd565b611075565b34801561026657600080fd5b5061027a610275366004611dd8565b611090565b60405161011691906123e7565b60066020526000908152604090205460ff1681565b600260005414156102bf5760405162461bcd60e51b81526004016100c890612382565b60026000556102cc611b5b565b6102d68383610559565b9050806080015160ff166001141561032957600354604082015163ffffffff9081169116146103175760405162461bcd60e51b81526004016100c890611ffc565b6103248160a00151611128565b61035e565b806080015160ff1660101415610346576103248160a00151611309565b60405162461bcd60e51b81526004016100c890611f4d565b6020908101516000908152600490915260408120805460ff1916600190811790915590555050565b60026020526000908152604090206001015463ffffffff1681565b600354640100000000900463ffffffff1681565b600260005414156103d85760405162461bcd60e51b81526004016100c890612382565b600260005560015460ff838116600160a01b90920416141561040c5760405162461bcd60e51b81526004016100c8906120bc565b600061041c34633b9aca00611565565b9050600061042e34633b9aca006115b0565b90508061044d5760405162461bcd60e51b81526004016100c89061216f565b604051339083156108fc029084906000818181858888f1935050505015801561047a573d6000803e3d6000fd5b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08334036040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505060015460405133945073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc293507f6bbd554ad75919f71fd91bf917ca6e4f41c10f03ab25751596a22253bb39aab89250610545918991600160a01b90910460ff16906009908c9089908c906124f6565b60405180910390a350506001600055505050565b610561611b5b565b6105a5600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b60ff168082526001146105ca5760405162461bcd60e51b81526004016100c890612085565b61060e600184848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116219050565b63ffffffff1660408083019190915280516020601f850181900481028201810190925283815260009161066191600591879087908190840183828082843760009201919091525092939250506115f29050565b60ff16905060008160420260060190506106b48186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116219050565b63ffffffff166060840152604080516020601f87018190048102820181019092528581526107069183918288039189908990819084018382808284376000920191909152509294939250506116509050565b805160209182012084820181905260009081526004909152604090205460ff16156107435760405162461bcd60e51b81526004016100c890611f79565b61074b611b92565b60408085015163ffffffff166000908152600260209081529082902082518154606093810282018401855293810184815290939192849284918401828280156107bd57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161079f575b50505091835250506001919091015463ffffffff166020909101528051519091506107fa5760405162461bcd60e51b81526004016100c8906123b9565b602081015163ffffffff16158061081a575042816020015163ffffffff16115b6108365760405162461bcd60e51b81526004016100c890612241565b82600a6003836000015151600a028161084b57fe5b046002028161085657fe5b0460010111156108785760405162461bcd60e51b81526004016100c8906121e7565b60001960005b84811015610a965760006108d1826042026006018a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b90508260010b8160ff16136108f85760405162461bcd60e51b81526004016100c8906122af565b8060ff1692506000610949836042026007018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116e39050565b90506000610996846042026027018c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116e39050565b905060006109e3856042026047018d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b87518051601b90920192509060ff86169081106109fc57fe5b60200260200101516001600160a01b031660018b6020015183868660405160008152602001604052604051610a349493929190611ed9565b6020604051602081039080840390855afa158015610a56573d6000803e3d6000fd5b505050602060405103516001600160a01b031614610a865760405162461bcd60e51b81526004016100c8906120ff565b50506001909201915061087e9050565b50610add8360040188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b60ff166080860152604080516020601f8901819004810282018101909252878152610b33916005860191600419878b0301918b908b90819084018382808284376000920191909152509294939250506116509050565b60a0860152509295945050505050565b60026000541415610b665760405162461bcd60e51b81526004016100c890612382565b600260005560015460ff848116600160a01b909204161415610b9a5760405162461bcd60e51b81526004016100c8906120bc565b6000600160149054906101000a900460ff169050600080886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bea57600080fd5b505afa158015610bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c229190611dfc565b6001600160a01b038a1660009081526006602052604090205490915060ff1615610d9157604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac90610c749033908c90600401611e91565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b50505050886001600160a01b031663026b05396040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdf57600080fd5b505afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190611dfc565b9250886001600160a01b0316631ba46cfd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5257600080fd5b505afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190611d15565b9150610fc9565b6040516370a0823160e01b81526000906001600160a01b038b16906370a0823190610dc0903090600401611e7d565b60206040518083038186803b158015610dd857600080fd5b505afa158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e109190611d15565b9050610e276001600160a01b038b1633308c611712565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190610e56903090600401611e7d565b60206040518083038186803b158015610e6e57600080fd5b505afa158015610e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea69190611d15565b9050610eb28183611770565b995060098360ff161115610f0c5789610ed58160ff600819870116600a0a6115b0565b9a508615610f0657610f0633610ef58360ff600819890116600a0a611565565b6001600160a01b038f1691906117b2565b60099350505b67ffffffffffffffff8016610f9c60098d6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5557600080fd5b505afa158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d9190611dfc565b849160ff910316600a0a6115b0565b1115610fba5760405162461bcd60e51b81526004016100c890611f0a565b50506001600160a01b03891691505b87610fe65760405162461bcd60e51b81526004016100c89061216f565b336001600160a01b031660001b827f6bbd554ad75919f71fd91bf917ca6e4f41c10f03ab25751596a22253bb39aab88886858c8e8c60405161102d969594939291906124f6565b60405180910390a35050600160005550505050505050565b60035463ffffffff1681565b6001546001600160a01b031681565b60046020526000908152604090205460ff1681565b6005602052600090815260409020546001600160a01b031681565b611098611b92565b63ffffffff8216600090815260026020908152604091829020825181546060938102820184018552938101848152909391928492849184018282801561110757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110e9575b50505091835250506001919091015463ffffffff1660209091015292915050565b60006111348282611621565b60035490915063ffffffff80831691811660010116146111665760405162461bcd60e51b81526004016100c8906121a6565b60006111738360046115f2565b905060608160ff1667ffffffffffffffff8111801561119157600080fd5b506040519080825280602002602001820160405280156111bb578160200160208202803683370190505b50905060005b8260ff1681101561120e5760006111de86600560148502016117d6565b9050808383815181106111ed57fe5b6001600160a01b0390921660209283029190910190910152506001016111c1565b506003805463ffffffff85811663ffffffff1983161790925516611230611b92565b506040805180820182528381526000602080830182905260035463ffffffff16825260028152929020815180519293849361126e9284920190611baa565b506020918201516001918201805463ffffffff1990811663ffffffff9384161790915560038054878416600090815260029096526040958690209094018054909216640100000000909404831642018316939093179055905491517fdfb80683934199683861bf00b64ecdf0984bbaf661bf27983dba382e99297a62926112f99286929116906124c2565b60405180910390a1505050505050565b60006113168260046115f2565b905060006113258360056115f2565b905060006113348460326117d6565b905060006113438560466115f2565b905060006113528660686116e3565b90508360ff168560ff16141561137a5760405162461bcd60e51b81526004016100c89061233c565b60015460ff858116600160a01b90920416146113a85760405162461bcd60e51b81526004016100c89061220a565b60015460ff838116600160a01b909204161461149f5760006113cb8760476116e3565b9050600083826040516020016113e2929190611e60565b60408051601f198184030181529181528151602092830120600081815260059093529120549091506001600160a01b0316806114375760006114258a60676115f2565b90506114338387868461180c565b9150505b6040516340c10f1960e01b81526001600160a01b038216906340c10f19906114659089908890600401611e91565b600060405180830381600087803b15801561147f57600080fd5b505af1158015611493573d6000803e3d6000fd5b5050505050505061155d565b60006114ac8760536117d6565b90506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156114e957600080fd5b505afa1580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190611dfc565b905060098160ff161115611546576115438360ff600819840116600a0a61191a565b92505b61155a6001600160a01b03831686856117b2565b50505b505050505050565b60006115a783836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250611954565b90505b92915050565b60006115a783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611988565b600081600101835110156116185760405162461bcd60e51b81526004016100c890612059565b50016001015190565b600081600401835110156116475760405162461bcd60e51b81526004016100c890612059565b50016004015190565b6060818301845110156116755760405162461bcd60e51b81526004016100c890612059565b606082158015611690576040519150602082016040526116da565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156116c95780518352602092830192016116b1565b5050858452601f01601f1916604052505b50949350505050565b600081602001835110156117095760405162461bcd60e51b81526004016100c890612059565b50016020015190565b61176a846323b872dd60e01b85858560405160240161173393929190611eaa565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526119bf565b50505050565b60006115a783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a4e565b6117d18363a9059cbb60e01b8484604051602401611733929190611e91565b505050565b600081601401835110156117fc5760405162461bcd60e51b81526004016100c890612059565b500160200151600160601b900490565b600154604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b815260609190911b6bffffffffffffffffffffffff1916601482018190526e5af43d82803e903d91602b57fd5bf360881b60288301526000918660378285f560405163a7a2d3fb60e01b81529093506001600160a01b038416915063a7a2d3fb9061189d908890889088906004016124d9565b600060405180830381600087803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b5050506000968752505060056020908152604080872080546001600160a01b0319166001600160a01b03851690811790915587526006909152909420805460ff19166001179055509192915050565b600082611929575060006115aa565b8282028284828161193657fe5b04146115a75760405162461bcd60e51b81526004016100c89061212e565b600081836119755760405162461bcd60e51b81526004016100c89190611ef7565b5082848161197f57fe5b06949350505050565b600081836119a95760405162461bcd60e51b81526004016100c89190611ef7565b5060008385816119b557fe5b0495945050505050565b6060611a14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a7a9092919063ffffffff16565b8051909150156117d15780806020019051810190611a329190611ce1565b6117d15760405162461bcd60e51b81526004016100c8906122f2565b60008184841115611a725760405162461bcd60e51b81526004016100c89190611ef7565b505050900390565b6060611a898484600085611a91565b949350505050565b6060611a9c85611b55565b611ab85760405162461bcd60e51b81526004016100c890612278565b60006060866001600160a01b03168587604051611ad59190611e44565b60006040518083038185875af1925050503d8060008114611b12576040519150601f19603f3d011682016040523d82523d6000602084013e611b17565b606091505b50915091508115611b2b579150611a899050565b805115611b3b5780518082602001fd5b8360405162461bcd60e51b81526004016100c89190611ef7565b3b151590565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a081019190915290565b60408051808201909152606081526000602082015290565b828054828255906000526020600020908101928215611bff579160200282015b82811115611bff57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611bca565b50611c0b929150611c0f565b5090565b5b80821115611c0b5780546001600160a01b0319168155600101611c10565b80356001600160a01b03811681146115aa57600080fd5b803563ffffffff811681146115aa57600080fd5b600060208284031215611c6a578081fd5b6115a78383611c2e565b60008060008060008060c08789031215611c8c578182fd5b611c968888611c2e565b955060208701359450604087013593506060870135611cb48161256b565b9250611cc38860808901611c45565b915060a0870135611cd38161255a565b809150509295509295509295565b600060208284031215611cf2578081fd5b81516115a78161255a565b600060208284031215611d0e578081fd5b5035919050565b600060208284031215611d26578081fd5b5051919050565b600080600060608486031215611d41578283fd5b833592506020840135611d538161256b565b9150611d628560408601611c45565b90509250925092565b60008060208385031215611d7d578182fd5b823567ffffffffffffffff80821115611d94578384fd5b818501915085601f830112611da7578384fd5b813581811115611db5578485fd5b866020828501011115611dc6578485fd5b60209290920196919550909350505050565b600060208284031215611de9578081fd5b813563ffffffff811681146115a7578182fd5b600060208284031215611e0d578081fd5b81516115a78161256b565b60008151808452611e3081602086016020860161252e565b601f01601f19169290920160200192915050565b60008251611e5681846020870161252e565b9190910192915050565b60f89290921b6001600160f81b0319168252600182015260210190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b901515815260200190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082526115a76020830184611e18565b60208082526023908201527f6272696467652062616c616e636520776f756c6420657863656564206d6178696040820152626d756d60e81b606082015260800190565b60208082526012908201527134b73b30b634b2102b20a09030b1ba34b7b760711b604082015260600190565b60208082526018908201527f5641412077617320616c72656164792065786563757465640000000000000000604082015260600190565b6020808252602c908201527f706c6561736520757365206c6f636b45544820746f207472616e73666572204560408201526b544820746f20536f6c616e6160a01b606082015260800190565b60208082526039908201527f6f6e6c79207468652063757272656e7420677561726469616e2073657420636160408201527f6e206368616e67652074686520677561726469616e2073657400000000000000606082015260800190565b60208082526012908201527152656164206f7574206f6620626f756e647360701b604082015260600190565b60208082526018908201527f5641412076657273696f6e20696e636f6d70617469626c650000000000000000604082015260600190565b60208082526023908201527f6d757374206e6f74207472616e7366657220746f207468652073616d6520636860408201526230b4b760e91b606082015260800190565b602080825260159082015274159050481cda59db985d1d5c99481a5b9d985b1a59605a1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601e908201527f7472756e636174656420616d6f756e74206d757374206e6f7420626520300000604082015260600190565b60208082526021908201527f696e646578206d75737420696e63726561736520696e207374657073206f66206040820152603160f81b606082015260800190565b6020808252600990820152686e6f2071756f72756d60b81b604082015260600190565b60208082526019908201527f7472616e73666572206d75737420626520696e636f6d696e6700000000000000604082015260600190565b60208082526018908201527f677561726469616e207365742068617320657870697265640000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526023908201527f7369676e617475726520696e6469636573206d75737420626520617363656e64604082015262696e6760e81b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526026908201527f73616d6520636861696e207472616e736665727320617265206e6f74207375706040820152651c1bdc9d195960d21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601490820152731a5b9d985b1a590819dd585c991a585b881cd95d60621b604082015260600190565b6020808252825160408383015280516060840181905260009291820190839060808601905b808310156124355783516001600160a01b0316825292840192600192909201919084019061240c565b5063ffffffff848801511660408701528094505050505092915050565b60006020825260ff835116602083015260208301516040830152604083015163ffffffff8082166060850152806060860151166080850152505060ff60808401511660a083015260a083015160c080840152611a8960e0840182611e18565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff93841681526020810192909252909116604082015260600190565b60ff968716815294861660208601529290941660408401526060830152608082019290925263ffffffff90911660a082015260c00190565b60005b83811015612549578181015183820152602001612531565b8381111561176a5750506000910152565b801515811461256857600080fd5b50565b60ff8116811461256857600080fdfea2646970667358221220efee3aa0256bf0285f463a6d366d44803785dbf94307fcbbb6dede96231639a564736f6c634300060c003300000000000000000000000000000000000000000000000000000000000000600000000000000000000000009a5e27995309a03f8b583febde7ef289fccdc6ae00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007580aa7e036dc199bf0e152c71004716ae0aa747
Deployed Bytecode
0x6080604052600436106100ab5760003560e01c8063707139601161006457806370713960146101c3578063822d82b3146101e357806399da1d3c146101f8578063a31fe4091461021a578063b6694c2a1461023a578063f951975a1461025a576100d1565b80631a2be4da146100e95780633bc0aee61461011f57806342b0aefa146101415780634db478401461016e57806358d62e4614610183578063600b9aa614610196576100d1565b366100d15760405162461bcd60e51b81526004016100c890611fb0565b60405180910390fd5b60405162461bcd60e51b81526004016100c890611fb0565b3480156100f557600080fd5b50610109610104366004611c59565b610287565b6040516101169190611ece565b60405180910390f35b34801561012b57600080fd5b5061013f61013a366004611d6b565b61029c565b005b34801561014d57600080fd5b5061016161015c366004611dd8565b610386565b60405161011691906124b1565b34801561017a57600080fd5b506101616103a1565b61013f610191366004611d2d565b6103b5565b3480156101a257600080fd5b506101b66101b1366004611d6b565b610559565b6040516101169190612452565b3480156101cf57600080fd5b5061013f6101de366004611c74565b610b43565b3480156101ef57600080fd5b50610161611045565b34801561020457600080fd5b5061020d611051565b6040516101169190611e7d565b34801561022657600080fd5b50610109610235366004611cfd565b611060565b34801561024657600080fd5b5061020d610255366004611cfd565b611075565b34801561026657600080fd5b5061027a610275366004611dd8565b611090565b60405161011691906123e7565b60066020526000908152604090205460ff1681565b600260005414156102bf5760405162461bcd60e51b81526004016100c890612382565b60026000556102cc611b5b565b6102d68383610559565b9050806080015160ff166001141561032957600354604082015163ffffffff9081169116146103175760405162461bcd60e51b81526004016100c890611ffc565b6103248160a00151611128565b61035e565b806080015160ff1660101415610346576103248160a00151611309565b60405162461bcd60e51b81526004016100c890611f4d565b6020908101516000908152600490915260408120805460ff1916600190811790915590555050565b60026020526000908152604090206001015463ffffffff1681565b600354640100000000900463ffffffff1681565b600260005414156103d85760405162461bcd60e51b81526004016100c890612382565b600260005560015460ff838116600160a01b90920416141561040c5760405162461bcd60e51b81526004016100c8906120bc565b600061041c34633b9aca00611565565b9050600061042e34633b9aca006115b0565b90508061044d5760405162461bcd60e51b81526004016100c89061216f565b604051339083156108fc029084906000818181858888f1935050505015801561047a573d6000803e3d6000fd5b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08334036040518263ffffffff1660e01b81526004016000604051808303818588803b1580156104cc57600080fd5b505af11580156104e0573d6000803e3d6000fd5b505060015460405133945073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc293507f6bbd554ad75919f71fd91bf917ca6e4f41c10f03ab25751596a22253bb39aab89250610545918991600160a01b90910460ff16906009908c9089908c906124f6565b60405180910390a350506001600055505050565b610561611b5b565b6105a5600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b60ff168082526001146105ca5760405162461bcd60e51b81526004016100c890612085565b61060e600184848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116219050565b63ffffffff1660408083019190915280516020601f850181900481028201810190925283815260009161066191600591879087908190840183828082843760009201919091525092939250506115f29050565b60ff16905060008160420260060190506106b48186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116219050565b63ffffffff166060840152604080516020601f87018190048102820181019092528581526107069183918288039189908990819084018382808284376000920191909152509294939250506116509050565b805160209182012084820181905260009081526004909152604090205460ff16156107435760405162461bcd60e51b81526004016100c890611f79565b61074b611b92565b60408085015163ffffffff166000908152600260209081529082902082518154606093810282018401855293810184815290939192849284918401828280156107bd57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161079f575b50505091835250506001919091015463ffffffff166020909101528051519091506107fa5760405162461bcd60e51b81526004016100c8906123b9565b602081015163ffffffff16158061081a575042816020015163ffffffff16115b6108365760405162461bcd60e51b81526004016100c890612241565b82600a6003836000015151600a028161084b57fe5b046002028161085657fe5b0460010111156108785760405162461bcd60e51b81526004016100c8906121e7565b60001960005b84811015610a965760006108d1826042026006018a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b90508260010b8160ff16136108f85760405162461bcd60e51b81526004016100c8906122af565b8060ff1692506000610949836042026007018b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116e39050565b90506000610996846042026027018c8c8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506116e39050565b905060006109e3856042026047018d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b87518051601b90920192509060ff86169081106109fc57fe5b60200260200101516001600160a01b031660018b6020015183868660405160008152602001604052604051610a349493929190611ed9565b6020604051602081039080840390855afa158015610a56573d6000803e3d6000fd5b505050602060405103516001600160a01b031614610a865760405162461bcd60e51b81526004016100c8906120ff565b50506001909201915061087e9050565b50610add8360040188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115f29050565b60ff166080860152604080516020601f8901819004810282018101909252878152610b33916005860191600419878b0301918b908b90819084018382808284376000920191909152509294939250506116509050565b60a0860152509295945050505050565b60026000541415610b665760405162461bcd60e51b81526004016100c890612382565b600260005560015460ff848116600160a01b909204161415610b9a5760405162461bcd60e51b81526004016100c8906120bc565b6000600160149054906101000a900460ff169050600080886001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610bea57600080fd5b505afa158015610bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c229190611dfc565b6001600160a01b038a1660009081526006602052604090205490915060ff1615610d9157604051632770a7eb60e21b81526001600160a01b038a1690639dc29fac90610c749033908c90600401611e91565b600060405180830381600087803b158015610c8e57600080fd5b505af1158015610ca2573d6000803e3d6000fd5b50505050886001600160a01b031663026b05396040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdf57600080fd5b505afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190611dfc565b9250886001600160a01b0316631ba46cfd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5257600080fd5b505afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190611d15565b9150610fc9565b6040516370a0823160e01b81526000906001600160a01b038b16906370a0823190610dc0903090600401611e7d565b60206040518083038186803b158015610dd857600080fd5b505afa158015610dec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e109190611d15565b9050610e276001600160a01b038b1633308c611712565b6040516370a0823160e01b81526000906001600160a01b038c16906370a0823190610e56903090600401611e7d565b60206040518083038186803b158015610e6e57600080fd5b505afa158015610e82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea69190611d15565b9050610eb28183611770565b995060098360ff161115610f0c5789610ed58160ff600819870116600a0a6115b0565b9a508615610f0657610f0633610ef58360ff600819890116600a0a611565565b6001600160a01b038f1691906117b2565b60099350505b67ffffffffffffffff8016610f9c60098d6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5557600080fd5b505afa158015610f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8d9190611dfc565b849160ff910316600a0a6115b0565b1115610fba5760405162461bcd60e51b81526004016100c890611f0a565b50506001600160a01b03891691505b87610fe65760405162461bcd60e51b81526004016100c89061216f565b336001600160a01b031660001b827f6bbd554ad75919f71fd91bf917ca6e4f41c10f03ab25751596a22253bb39aab88886858c8e8c60405161102d969594939291906124f6565b60405180910390a35050600160005550505050505050565b60035463ffffffff1681565b6001546001600160a01b031681565b60046020526000908152604090205460ff1681565b6005602052600090815260409020546001600160a01b031681565b611098611b92565b63ffffffff8216600090815260026020908152604091829020825181546060938102820184018552938101848152909391928492849184018282801561110757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110e9575b50505091835250506001919091015463ffffffff1660209091015292915050565b60006111348282611621565b60035490915063ffffffff80831691811660010116146111665760405162461bcd60e51b81526004016100c8906121a6565b60006111738360046115f2565b905060608160ff1667ffffffffffffffff8111801561119157600080fd5b506040519080825280602002602001820160405280156111bb578160200160208202803683370190505b50905060005b8260ff1681101561120e5760006111de86600560148502016117d6565b9050808383815181106111ed57fe5b6001600160a01b0390921660209283029190910190910152506001016111c1565b506003805463ffffffff85811663ffffffff1983161790925516611230611b92565b506040805180820182528381526000602080830182905260035463ffffffff16825260028152929020815180519293849361126e9284920190611baa565b506020918201516001918201805463ffffffff1990811663ffffffff9384161790915560038054878416600090815260029096526040958690209094018054909216640100000000909404831642018316939093179055905491517fdfb80683934199683861bf00b64ecdf0984bbaf661bf27983dba382e99297a62926112f99286929116906124c2565b60405180910390a1505050505050565b60006113168260046115f2565b905060006113258360056115f2565b905060006113348460326117d6565b905060006113438560466115f2565b905060006113528660686116e3565b90508360ff168560ff16141561137a5760405162461bcd60e51b81526004016100c89061233c565b60015460ff858116600160a01b90920416146113a85760405162461bcd60e51b81526004016100c89061220a565b60015460ff838116600160a01b909204161461149f5760006113cb8760476116e3565b9050600083826040516020016113e2929190611e60565b60408051601f198184030181529181528151602092830120600081815260059093529120549091506001600160a01b0316806114375760006114258a60676115f2565b90506114338387868461180c565b9150505b6040516340c10f1960e01b81526001600160a01b038216906340c10f19906114659089908890600401611e91565b600060405180830381600087803b15801561147f57600080fd5b505af1158015611493573d6000803e3d6000fd5b5050505050505061155d565b60006114ac8760536117d6565b90506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156114e957600080fd5b505afa1580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190611dfc565b905060098160ff161115611546576115438360ff600819840116600a0a61191a565b92505b61155a6001600160a01b03831686856117b2565b50505b505050505050565b60006115a783836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250611954565b90505b92915050565b60006115a783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611988565b600081600101835110156116185760405162461bcd60e51b81526004016100c890612059565b50016001015190565b600081600401835110156116475760405162461bcd60e51b81526004016100c890612059565b50016004015190565b6060818301845110156116755760405162461bcd60e51b81526004016100c890612059565b606082158015611690576040519150602082016040526116da565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156116c95780518352602092830192016116b1565b5050858452601f01601f1916604052505b50949350505050565b600081602001835110156117095760405162461bcd60e51b81526004016100c890612059565b50016020015190565b61176a846323b872dd60e01b85858560405160240161173393929190611eaa565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526119bf565b50505050565b60006115a783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a4e565b6117d18363a9059cbb60e01b8484604051602401611733929190611e91565b505050565b600081601401835110156117fc5760405162461bcd60e51b81526004016100c890612059565b500160200151600160601b900490565b600154604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b815260609190911b6bffffffffffffffffffffffff1916601482018190526e5af43d82803e903d91602b57fd5bf360881b60288301526000918660378285f560405163a7a2d3fb60e01b81529093506001600160a01b038416915063a7a2d3fb9061189d908890889088906004016124d9565b600060405180830381600087803b1580156118b757600080fd5b505af11580156118cb573d6000803e3d6000fd5b5050506000968752505060056020908152604080872080546001600160a01b0319166001600160a01b03851690811790915587526006909152909420805460ff19166001179055509192915050565b600082611929575060006115aa565b8282028284828161193657fe5b04146115a75760405162461bcd60e51b81526004016100c89061212e565b600081836119755760405162461bcd60e51b81526004016100c89190611ef7565b5082848161197f57fe5b06949350505050565b600081836119a95760405162461bcd60e51b81526004016100c89190611ef7565b5060008385816119b557fe5b0495945050505050565b6060611a14826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a7a9092919063ffffffff16565b8051909150156117d15780806020019051810190611a329190611ce1565b6117d15760405162461bcd60e51b81526004016100c8906122f2565b60008184841115611a725760405162461bcd60e51b81526004016100c89190611ef7565b505050900390565b6060611a898484600085611a91565b949350505050565b6060611a9c85611b55565b611ab85760405162461bcd60e51b81526004016100c890612278565b60006060866001600160a01b03168587604051611ad59190611e44565b60006040518083038185875af1925050503d8060008114611b12576040519150601f19603f3d011682016040523d82523d6000602084013e611b17565b606091505b50915091508115611b2b579150611a899050565b805115611b3b5780518082602001fd5b8360405162461bcd60e51b81526004016100c89190611ef7565b3b151590565b6040805160c0810182526000808252602082018190529181018290526060808201839052608082019290925260a081019190915290565b60408051808201909152606081526000602082015290565b828054828255906000526020600020908101928215611bff579160200282015b82811115611bff57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611bca565b50611c0b929150611c0f565b5090565b5b80821115611c0b5780546001600160a01b0319168155600101611c10565b80356001600160a01b03811681146115aa57600080fd5b803563ffffffff811681146115aa57600080fd5b600060208284031215611c6a578081fd5b6115a78383611c2e565b60008060008060008060c08789031215611c8c578182fd5b611c968888611c2e565b955060208701359450604087013593506060870135611cb48161256b565b9250611cc38860808901611c45565b915060a0870135611cd38161255a565b809150509295509295509295565b600060208284031215611cf2578081fd5b81516115a78161255a565b600060208284031215611d0e578081fd5b5035919050565b600060208284031215611d26578081fd5b5051919050565b600080600060608486031215611d41578283fd5b833592506020840135611d538161256b565b9150611d628560408601611c45565b90509250925092565b60008060208385031215611d7d578182fd5b823567ffffffffffffffff80821115611d94578384fd5b818501915085601f830112611da7578384fd5b813581811115611db5578485fd5b866020828501011115611dc6578485fd5b60209290920196919550909350505050565b600060208284031215611de9578081fd5b813563ffffffff811681146115a7578182fd5b600060208284031215611e0d578081fd5b81516115a78161256b565b60008151808452611e3081602086016020860161252e565b601f01601f19169290920160200192915050565b60008251611e5681846020870161252e565b9190910192915050565b60f89290921b6001600160f81b0319168252600182015260210190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b901515815260200190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082526115a76020830184611e18565b60208082526023908201527f6272696467652062616c616e636520776f756c6420657863656564206d6178696040820152626d756d60e81b606082015260800190565b60208082526012908201527134b73b30b634b2102b20a09030b1ba34b7b760711b604082015260600190565b60208082526018908201527f5641412077617320616c72656164792065786563757465640000000000000000604082015260600190565b6020808252602c908201527f706c6561736520757365206c6f636b45544820746f207472616e73666572204560408201526b544820746f20536f6c616e6160a01b606082015260800190565b60208082526039908201527f6f6e6c79207468652063757272656e7420677561726469616e2073657420636160408201527f6e206368616e67652074686520677561726469616e2073657400000000000000606082015260800190565b60208082526012908201527152656164206f7574206f6620626f756e647360701b604082015260600190565b60208082526018908201527f5641412076657273696f6e20696e636f6d70617469626c650000000000000000604082015260600190565b60208082526023908201527f6d757374206e6f74207472616e7366657220746f207468652073616d6520636860408201526230b4b760e91b606082015260800190565b602080825260159082015274159050481cda59db985d1d5c99481a5b9d985b1a59605a1b604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252601e908201527f7472756e636174656420616d6f756e74206d757374206e6f7420626520300000604082015260600190565b60208082526021908201527f696e646578206d75737420696e63726561736520696e207374657073206f66206040820152603160f81b606082015260800190565b6020808252600990820152686e6f2071756f72756d60b81b604082015260600190565b60208082526019908201527f7472616e73666572206d75737420626520696e636f6d696e6700000000000000604082015260600190565b60208082526018908201527f677561726469616e207365742068617320657870697265640000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526023908201527f7369676e617475726520696e6469636573206d75737420626520617363656e64604082015262696e6760e81b606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b60208082526026908201527f73616d6520636861696e207472616e736665727320617265206e6f74207375706040820152651c1bdc9d195960d21b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601490820152731a5b9d985b1a590819dd585c991a585b881cd95d60621b604082015260600190565b6020808252825160408383015280516060840181905260009291820190839060808601905b808310156124355783516001600160a01b0316825292840192600192909201919084019061240c565b5063ffffffff848801511660408701528094505050505092915050565b60006020825260ff835116602083015260208301516040830152604083015163ffffffff8082166060850152806060860151166080850152505060ff60808401511660a083015260a083015160c080840152611a8960e0840182611e18565b63ffffffff91909116815260200190565b63ffffffff92831681529116602082015260400190565b60ff93841681526020810192909252909116604082015260600190565b60ff968716815294861660208601529290941660408401526060830152608082019290925263ffffffff90911660a082015260c00190565b60005b83811015612549578181015183820152602001612531565b8381111561176a5750506000910152565b801515811461256857600080fd5b50565b60ff8116811461256857600080fdfea2646970667358221220efee3aa0256bf0285f463a6d366d44803785dbf94307fcbbb6dede96231639a564736f6c634300060c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000600000000000000000000000009a5e27995309a03f8b583febde7ef289fccdc6ae00000000000000000000000000000000000000000000000000000000000151800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007580aa7e036dc199bf0e152c71004716ae0aa747
-----Decoded View---------------
Arg [0] : initial_guardian_set (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [1] : wrapped_asset_master (address): 0x9A5e27995309a03f8B583feBdE7eF289FcCdC6Ae
Arg [2] : _guardian_set_expirity (uint32): 86400
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 0000000000000000000000009a5e27995309a03f8b583febde7ef289fccdc6ae
Arg [2] : 0000000000000000000000000000000000000000000000000000000000015180
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [6] : 0000000000000000000000007580aa7e036dc199bf0e152c71004716ae0aa747
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 35.44% | $1.92 | 230,132.7506 | $441,854.88 | |
ETH | 17.85% | $102,448 | 2.1723 | $222,545.68 | |
ETH | 14.10% | $3,283.75 | 53.5546 | $175,859.97 | |
ETH | 7.41% | $0.995733 | 92,747.8972 | $92,352.14 | |
ETH | 4.92% | $24.77 | 2,474.6675 | $61,297.51 | |
ETH | 2.68% | $13.29 | 2,511.715 | $33,380.69 | |
ETH | 2.65% | $0.038797 | 850,516.6747 | $32,997.33 | |
ETH | 2.10% | $0.114769 | 228,026.7945 | $26,170.41 | |
ETH | 2.04% | $0.99788 | 25,440.0015 | $25,386.07 | |
ETH | 1.90% | $2,717.42 | 8.7385 | $23,746.11 | |
ETH | 1.52% | $0.37212 | 51,085 | $19,009.75 | |
ETH | 0.96% | $0.204949 | 58,141.9031 | $11,916.12 | |
ETH | 0.77% | $0.999721 | 9,563.7218 | $9,561.05 | |
ETH | 0.70% | $7,652.74 | 1.1328 | $8,669.05 | |
ETH | 0.65% | $0.812129 | 10,055.527 | $8,166.38 | |
ETH | 0.59% | $0.199521 | 37,000.9708 | $7,382.47 | |
ETH | 0.58% | $0.015759 | 460,280.1771 | $7,253.76 | |
ETH | 0.52% | $0.999971 | 6,469.0691 | $6,468.88 | |
ETH | 0.52% | $0.02593 | 249,223.2935 | $6,462.3 | |
ETH | 0.46% | $22,610 | 0.2512 | $5,679.08 | |
ETH | 0.42% | $11,064.76 | 0.4704 | $5,205.24 | |
ETH | 0.25% | $1.35 | 2,336.4072 | $3,154.15 | |
ETH | 0.17% | $9.49 | 223.1004 | $2,117.22 | |
ETH | 0.17% | $0.011003 | 187,440 | $2,062.41 | |
ETH | 0.10% | $0.337691 | 3,740.7351 | $1,263.21 | |
ETH | 0.09% | $0.998115 | 1,180 | $1,177.78 | |
ETH | 0.08% | $1,955.01 | 0.501 | $979.47 | |
ETH | 0.07% | $0.854632 | 1,050 | $897.36 | |
ETH | 0.06% | $0.051282 | 13,609.6992 | $697.93 | |
ETH | 0.04% | $0.000432 | 1,212,171.4603 | $523.4 | |
ETH | 0.04% | $0.22899 | 2,107.65 | $482.63 | |
ETH | 0.04% | $0.998831 | 469.8477 | $469.3 | |
ETH | 0.03% | $0.754135 | 535.7282 | $404.01 | |
ETH | 0.02% | $354 | 0.8648 | $306.14 | |
ETH | 0.01% | $2.9 | 56 | $162.4 | |
ETH | <0.01% | $1 | 107.1668 | $107.49 | |
ETH | <0.01% | $1.04 | 100 | $103.8 | |
ETH | <0.01% | $0.002895 | 26,558.4662 | $76.88 | |
ETH | <0.01% | $0.000933 | 76,359.6005 | $71.22 | |
ETH | <0.01% | $0.026139 | 2,282.0157 | $59.65 | |
ETH | <0.01% | $0.027632 | 2,000 | $55.26 | |
ETH | <0.01% | $1.12 | 45.2155 | $50.64 | |
ETH | <0.01% | $0.132418 | 343.1015 | $45.43 | |
ETH | <0.01% | $1.33 | 29.835 | $39.68 | |
ETH | <0.01% | $1.98 | 17.3863 | $34.42 | |
ETH | <0.01% | $0.028103 | 923.4008 | $25.95 | |
ETH | <0.01% | $11.93 | 2.0988 | $25.04 | |
ETH | <0.01% | $0.146958 | 160 | $23.51 | |
ETH | <0.01% | $0.444776 | 51 | $22.68 | |
ETH | <0.01% | $0.175553 | 100 | $17.56 | |
ETH | <0.01% | $168.64 | 0.1039 | $17.52 | |
ETH | <0.01% | $0.007158 | 2,000 | $14.32 | |
ETH | <0.01% | $4.57 | 3 | $13.71 | |
ETH | <0.01% | $6.63 | 2.0056 | $13.3 | |
ETH | <0.01% | $0.143068 | 43.9918 | $6.29 | |
ETH | <0.01% | $46.7 | 0.1 | $4.67 | |
ETH | <0.01% | $0.117517 | 39 | $4.58 | |
ETH | <0.01% | $0.834868 | 5 | $4.17 | |
ETH | <0.01% | $0.456665 | 8 | $3.65 | |
ETH | <0.01% | $0.026609 | 99.85 | $2.66 | |
ETH | <0.01% | $2.64 | 1 | $2.64 | |
ETH | <0.01% | $0.587217 | 2 | $1.17 | |
ETH | <0.01% | $23.87 | 0.025 | $0.5967 | |
ETH | <0.01% | $78.84 | 0.0032 | $0.2522 | |
ETH | <0.01% | $102,507 | 0.000001 | $0.1025 | |
BASE | <0.01% | $0.011031 | 10 | $0.1103 |
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.