Polygon Sponsored slots available. Book your slot here!
Contract Overview
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
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:
DeFiBasket
Compiler Version
v0.8.6+commit.11564f7e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "./interfaces/IDeFiBasket.sol"; import "./Wallet.sol"; import "./libraries/DBDataTypes.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; /** * @title DeFiBasket * @author DeFi Basket * * @notice Coordinates portfolio creation, deposits/withdrawals, and fee payments. * * @dev This contract has 3 main functions: * * 1. Mint and manage NFTs * 1.1 Track ownership of NFTs * 1.2 Track NFT and Wallet relationship * 2. Create and manage wallets * 2.1 Control deposits / withdrawals to wallets * 2.2 Control the permissions for delegate calls to bridges * 3. Collect fees for the DeFi Basket protocol */ contract DeFiBasket is IDeFiBasket, ERC721, Ownable { using SafeERC20 for IERC20; // Modifiers modifier onlyNFTOwner(uint256 nftId) { require( msg.sender == ownerOf(nftId), "DEFIBASKET: ONLY NFT OWNER CAN CALL THIS FUNCTION" ); _; } modifier checkInputs(DBDataTypes.TokenData calldata inputs, uint256 ethAmount) { require( inputs.tokens.length == inputs.amounts.length, "DEFIBASKET: MISMATCH IN LENGTH BETWEEN TOKENS AND AMOUNTS" ); for (uint16 i = 0; i < inputs.amounts.length; i++) { require( inputs.amounts[i] > 0, "DEFIBASKET WALLET: ERC20 TOKEN AMOUNTS NEED TO BE > 0" ); } require( inputs.amounts.length > 0 || ethAmount > 0, // ERC20 Tokens or ETH is needed "DEFIBASKET: AN AMOUNT IN ETHER OR ERC20 TOKENS IS NEEDED" ); _; } modifier checkBridgeCalls(address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls) { require( bridgeAddresses.length == bridgeEncodedCalls.length, "DEFIBASKET: BRIDGE ENCODED CALLS AND ADDRESSES MUST HAVE THE SAME LENGTH" ); _; } // NFT properties uint256 public tokenCounter = 0; mapping(uint256 => address) private _nftIdToWallet; string _nftImageURI = "https://www.defibasket.org/api/get-nft-metadata/"; // Address of the implementation of the Wallet contract address immutable implementationWalletAddress; // Constructor constructor() ERC721("DeFi Basket NFT", "BASKETNFT") Ownable() { // Deploy a Wallet implementation that will be used as template for clones implementationWalletAddress = address(new Wallet()); } // External functions /** * @notice Returns wallet address of a given NFT Id. * * @dev Each NFT Id is associated to its own Wallet, which is a contract * that holds funds separately from other users' funds. * * @param nftId NFT Id */ function walletOf(uint256 nftId) public view returns (address) { return _nftIdToWallet[nftId]; } /** * @notice Create a portfolio. * * @dev The first step to create a portfolio is composed of 3 steps: * * 1. Mint an NFT and Wallet for the corresponding NFT. * 2. Transfer resources (ETH and ERC20 tokens) to Wallet. * 3. Process bridge calls (interact with Uniswap/Aave...). * * @param inputs ERC20 token addresses and amounts that will enter the contract * @param bridgeAddresses Addresses of deployed bridge contracts * @param bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function createPortfolio( DBDataTypes.TokenData calldata inputs, address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls ) payable external checkInputs(inputs, msg.value) checkBridgeCalls(bridgeAddresses, bridgeEncodedCalls) override { uint256 nftId = _mintNFT(msg.sender); _depositToWallet(nftId, inputs, msg.value); _writeToWallet(nftId, bridgeAddresses, bridgeEncodedCalls); } /** * @notice Deposit more funds into an existing portfolio. * * @dev The deposit function is composed of 2 steps: * * 1. Transfer resources (ETH and ERC20 tokens) to Wallet. * 2. Process bridge calls (interact with Uniswap/Aave...). * * @param nftId NFT Id * @param inputs ERC20 token addresses and amounts that will enter the contract * @param bridgeAddresses Addresses of deployed bridge contracts * @param bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function depositPortfolio( uint256 nftId, DBDataTypes.TokenData calldata inputs, address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls ) payable external checkInputs(inputs, msg.value) checkBridgeCalls(bridgeAddresses, bridgeEncodedCalls) onlyNFTOwner(nftId) override { emit DEFIBASKET_DEPOSIT(); _depositToWallet(nftId, inputs, msg.value); _writeToWallet(nftId, bridgeAddresses, bridgeEncodedCalls); } /** * @notice Edit positions of an existing portfolio. No deposits or withdrawals allowed. * * @dev This functions only processes bridge calls, no deposits or withdrawals on the wallet. * * @param nftId NFT Id * @param bridgeAddresses Addresses of deployed bridge contracts * @param bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function editPortfolio( uint256 nftId, address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls ) external checkBridgeCalls(bridgeAddresses, bridgeEncodedCalls) onlyNFTOwner(nftId) override { emit DEFIBASKET_EDIT(); _writeToWallet(nftId, bridgeAddresses, bridgeEncodedCalls); } /** * @notice Deposit more funds into an existing portfolio. * * @dev The withdraw function is composed of 3 steps: * * 1. Process bridge calls (interact with Uniswap/Aave...). * 2. Transfer resources (ETH and ERC20 tokens) to NFT owner. * * @param nftId NFT Id * @param outputs ERC20 token addresses and percentages that will exit the contract * @param outputEthPercentage percentage of ETH in portfolio that will exit the contract * @param bridgeAddresses Addresses of deployed bridge contracts * @param bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function withdrawPortfolio( uint256 nftId, DBDataTypes.TokenData calldata outputs, uint256 outputEthPercentage, address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls ) external checkInputs(outputs, outputEthPercentage) checkBridgeCalls(bridgeAddresses, bridgeEncodedCalls) onlyNFTOwner(nftId) override { _writeToWallet(nftId, bridgeAddresses, bridgeEncodedCalls); _withdrawFromWallet(nftId, outputs, outputEthPercentage); } // Internal functions /** * @notice Mints an NFT given an NFT owner. * * @dev All NFTs inside this contract have a wallet linked to it. So, whenever an NFT is minted a new wallet is * created that will hold funds that corresponds to the portfolio owned by this NFT. * * @param nftOwner address of NFT owner */ function _mintNFT(address nftOwner) internal returns (uint256){ // Clone Wallet using implementation Wallet as template // See https://eips.ethereum.org/EIPS/eip-1167 for reference address walletAddress = Clones.clone(implementationWalletAddress); // Save NFT data uint256 nftId = tokenCounter; _nftIdToWallet[nftId] = walletAddress; tokenCounter = tokenCounter + 1; // Mint NFT _safeMint(nftOwner, nftId); emit DEFIBASKET_CREATE(nftId, walletAddress); return nftId; } /** * @notice Transfer deposited ETH and ERC20 tokens to the Wallet linked to the referenced NFT. * * @dev Transfer assets to the corresponding Wallet going through the following steps: * 1. Transfer deposited ETH into the DeFi Basket contract to the Wallet contract. * 2. Transfer approved ERC20 tokens from the user account to the Wallet contract. * 3. Charge 0.1% fee for DeFi Basket * * @param nftId NFT Id * @param inputs ERC20 token addresses and amounts that entered the contract and will go to Wallet * @param ethAmount ETH amount that entered the contract and will go to Wallet */ function _depositToWallet( uint256 nftId, DBDataTypes.TokenData calldata inputs, uint256 ethAmount ) internal { // Pay 0.1% fee on ETH deposit to DeFi Basket address defibasketContractOwner = owner(); uint256 defibasketFee = ethAmount / 1000; payable(defibasketContractOwner).call{value: defibasketFee}(""); // Transfer 99.9% of ETH deposit to Wallet address walletAddress = walletOf(nftId); payable(walletAddress).call{value: ethAmount - defibasketFee}(""); // For each ERC20: Charge 0.1% DeFi Basket fee and transfer tokens to Wallet for (uint16 i = 0; i < inputs.tokens.length; i++) { // Pay 0.1% fee on ERC20 deposit to DeFi Basket defibasketFee = inputs.amounts[i] / 1000; IERC20(inputs.tokens[i]).safeTransferFrom(ownerOf(nftId), defibasketContractOwner, defibasketFee); // Transfer 99.9% of ERC20 token to Wallet IERC20(inputs.tokens[i]).safeTransferFrom(ownerOf(nftId), walletAddress, inputs.amounts[i] - defibasketFee); } } /** * @notice This is how DeFi Basket communicates with other protocols. * * @dev This is where the magic happens. Bridges interact with delegate calls to enable DeFi Basket to interact with * a wide and expanding variety of protocols. * * @param nftId NFT Id * @param _bridgeAddresses Addresses of deployed bridges that will be called * @param _bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function _writeToWallet( uint256 nftId, address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls ) internal { address walletAddress = walletOf(nftId); Wallet wallet = Wallet(payable(walletAddress)); wallet.useBridges(_bridgeAddresses, _bridgeEncodedCalls); } /** * @notice Transfer ETH and ERC20 tokens back to the owner of the corresponding NFT. * * @param nftId NFT Id * @param outputs ERC20 token addresses and percentages that will exit the Wallet and go to NFT owner * @param outputEthPercentage ETH percentage that will exit the Wallet and go to NFT owner */ function _withdrawFromWallet( uint256 nftId, DBDataTypes.TokenData calldata outputs, uint256 outputEthPercentage ) internal { uint256[] memory outputAmounts; uint256 outputEth; Wallet wallet = Wallet(payable(walletOf(nftId))); (outputAmounts, outputEth) = wallet.withdraw(outputs, outputEthPercentage, ownerOf(nftId)); emit DEFIBASKET_WITHDRAW(outputAmounts, outputEth); } // Art related /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function setBaseURI(string memory nftImageURI) external onlyOwner { _nftImageURI = nftImageURI; } /** * @notice Returns the base URI for the NFT metadata * * @dev The URI of a specific token will be the base URI concatenated with the token id, e.g. for token 0 * the URI will be http://placeholder.com/0. */ function _baseURI() internal view override returns (string memory) { return _nftImageURI; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "../libraries/DBDataTypes.sol"; interface IDeFiBasket is IERC721 { // Events event DEFIBASKET_CREATE( uint256 nftId, address wallet ); event DEFIBASKET_DEPOSIT(); event DEFIBASKET_EDIT(); event DEFIBASKET_WITHDRAW( uint256[] outputAmounts, uint256 ethAmount ); function createPortfolio( DBDataTypes.TokenData calldata inputs, address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls ) payable external; function depositPortfolio( uint256 nftId, DBDataTypes.TokenData calldata inputs, address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls ) payable external; function editPortfolio( uint256 nftId, address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls ) external; function withdrawPortfolio( uint256 nftId, DBDataTypes.TokenData calldata outputs, uint256 outputEthPercentage, address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls ) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "./interfaces/IWallet.sol"; import "./libraries/DBDataTypes.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title Wallet * @author DeFi Basket * * @notice Wallet holds assets for an NFT and interacts with bridges to integrate with other DeFi protocols. * * @dev Wallet holds the funds and is quite extensible as we decided to go with an architecture of delegate calls and * bridges, which are contracts that shape the interfaces we use to interact with other protocols. */ contract Wallet is IWallet { using SafeERC20 for IERC20; address immutable _defibasketAddress; // Wallet only talks with DeFi Basket contract modifier defibasketOnly() { require( _defibasketAddress == msg.sender, "WALLET: ONLY THE DEFIBASKET CONTRACT CAN CALL THIS FUNCTION" ); _; } // This is needed for Wallet to receive funds from a contract event Received(address sender, uint256 amount); receive() external payable { emit Received(msg.sender, msg.value); } constructor() { _defibasketAddress = msg.sender; } /** * @notice This is how the Wallet interacts with DeFi protocols. * * @dev This gives the bridges control over the Wallet funds, so they can make all the transactions necessary to * build a portfolio. We need to ensure that all the bridges we support on the UI are as safe as they can be. * Example of bridges are QuickswapSwapBridge and AaveV2DepositBridge. * * @param bridgeAddresses Addresses of deployed bridge contracts * @param bridgeEncodedCalls Encoded calls to be passed on to delegate calls */ function useBridges( address[] calldata bridgeAddresses, bytes[] calldata bridgeEncodedCalls ) external override defibasketOnly { bool isSuccess; bytes memory result; for (uint16 i = 0; i < bridgeAddresses.length; i++) { (isSuccess, result) = bridgeAddresses[i].delegatecall(bridgeEncodedCalls[i]); // Assembly code was the only way we found to display clean revert error messages from delegate calls if (!isSuccess) { assembly { let ptr := mload(0x40) let size := returndatasize() returndatacopy(ptr, 0, size) revert(ptr, size) } } } } /** * @notice Withdraws funds from wallet back to NFT owner. * * @dev Transfers requested percentages back to NFT owner. * * @param outputs ERC20 token addresses and percentages that will exit the Wallet and go to NFT owner * @param outputEthPercentage percentage of ETH that will exit the Wallet and go to NFT owner * @param nftOwner NFT owner address */ function withdraw( DBDataTypes.TokenData calldata outputs, uint256 outputEthPercentage, address nftOwner ) external defibasketOnly override returns (uint256[] memory, uint256) { // Withdraws ERC20 tokens uint256[] memory outputTokenAmounts = new uint256[](outputs.tokens.length); for (uint16 i = 0; i < outputs.tokens.length; i++) { outputTokenAmounts[i] = IERC20(outputs.tokens[i]).balanceOf(address(this)) * outputs.amounts[i] / 100000; IERC20(outputs.tokens[i]).safeTransfer(nftOwner, outputTokenAmounts[i]); } // Withdraws ETH uint256 outputEthAmount = 0; if (outputEthPercentage > 0) { outputEthAmount = address(this).balance * outputEthPercentage / 100000; payable(nftOwner).call{value: outputEthAmount}(""); } return (outputTokenAmounts, outputEthAmount); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; library DBDataTypes { struct TokenData { address[] tokens; uint256[] amounts; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` 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 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.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 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' 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) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _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 require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.6; import "../libraries/DBDataTypes.sol"; interface IWallet { function useBridges(address[] calldata _bridgeAddresses, bytes[] calldata _bridgeEncodedCalls) external; function withdraw( DBDataTypes.TokenData calldata outputs, uint256 outputEthPercentage, address user) external returns (uint256[] memory, uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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 on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; 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"); (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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"nftId","type":"uint256"},{"indexed":false,"internalType":"address","name":"wallet","type":"address"}],"name":"DEFIBASKET_CREATE","type":"event"},{"anonymous":false,"inputs":[],"name":"DEFIBASKET_DEPOSIT","type":"event"},{"anonymous":false,"inputs":[],"name":"DEFIBASKET_EDIT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"outputAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"ethAmount","type":"uint256"}],"name":"DEFIBASKET_WITHDRAW","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"internalType":"struct DBDataTypes.TokenData","name":"inputs","type":"tuple"},{"internalType":"address[]","name":"bridgeAddresses","type":"address[]"},{"internalType":"bytes[]","name":"bridgeEncodedCalls","type":"bytes[]"}],"name":"createPortfolio","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"internalType":"struct DBDataTypes.TokenData","name":"inputs","type":"tuple"},{"internalType":"address[]","name":"bridgeAddresses","type":"address[]"},{"internalType":"bytes[]","name":"bridgeEncodedCalls","type":"bytes[]"}],"name":"depositPortfolio","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"internalType":"address[]","name":"bridgeAddresses","type":"address[]"},{"internalType":"bytes[]","name":"bridgeEncodedCalls","type":"bytes[]"}],"name":"editPortfolio","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"nftImageURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"}],"name":"walletOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"nftId","type":"uint256"},{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"internalType":"struct DBDataTypes.TokenData","name":"outputs","type":"tuple"},{"internalType":"uint256","name":"outputEthPercentage","type":"uint256"},{"internalType":"address[]","name":"bridgeAddresses","type":"address[]"},{"internalType":"bytes[]","name":"bridgeEncodedCalls","type":"bytes[]"}],"name":"withdrawPortfolio","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6000600755610100604052603060a08181529062003aad60c03980516200002f9160099160209091019062000161565b503480156200003d57600080fd5b50604080518082018252600f81526e1119519a4810985cdad95d08139195608a1b602080830191825283518085019094526009845268109054d2d15513919560ba1b908401528151919291620000969160009162000161565b508051620000ac90600190602084019062000161565b505050620000c9620000c36200010b60201b60201c565b6200010f565b604051620000d790620001f0565b604051809103906000f080158015620000f4573d6000803e3d6000fd5b5060601b6001600160601b03191660805262000252565b3390565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280546200016f9062000215565b90600052602060002090601f016020900481019282620001935760008555620001de565b82601f10620001ae57805160ff1916838001178555620001de565b82800160010185558215620001de579182015b82811115620001de578251825591602001919060010190620001c1565b50620001ec929150620001fe565b5090565b610bd28062002edb83390190565b5b80821115620001ec5760008155600101620001ff565b600181811c908216806200022a57607f821691505b602082108114156200024c57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160601c612c6a6200027160003960006113300152612c6a6000f3fe6080604052600436106101405760003560e01c80637804d8bd116100b6578063b88d4fde1161006f578063b88d4fde14610372578063c87b56dd14610392578063d082e381146103b2578063e0fa88e1146103c8578063e985e9c5146103fe578063f2fde38b1461044757600080fd5b80637804d8bd146102cc5780638da5cb5b146102ec57806391249f201461030a57806395d89b411461031d578063a22cb46514610332578063ad97faa41461035257600080fd5b806342842e0e1161010857806342842e0e1461021657806355f804b31461023657806362e33556146102565780636352211e1461026957806370a0823114610289578063715018a6146102b757600080fd5b806301ffc9a71461014557806306fdde031461017a578063081812fc1461019c578063095ea7b3146101d457806323b872dd146101f6575b600080fd5b34801561015157600080fd5b506101656101603660046121f4565b610467565b60405190151581526020015b60405180910390f35b34801561018657600080fd5b5061018f6104b9565b60405161017191906126b9565b3480156101a857600080fd5b506101bc6101b736600461230a565b61054b565b6040516001600160a01b039091168152602001610171565b3480156101e057600080fd5b506101f46101ef3660046120f9565b6105e5565b005b34801561020257600080fd5b506101f461021136600461200b565b6106fb565b34801561022257600080fd5b506101f461023136600461200b565b61072c565b34801561024257600080fd5b506101f461025136600461222e565b610747565b6101f4610264366004612276565b610788565b34801561027557600080fd5b506101bc61028436600461230a565b6108c8565b34801561029557600080fd5b506102a96102a4366004611fbd565b61093f565b604051908152602001610171565b3480156102c357600080fd5b506101f46109c6565b3480156102d857600080fd5b506101f46102e73660046123f6565b6109fc565b3480156102f857600080fd5b506006546001600160a01b03166101bc565b6101f4610318366004612359565b610b6b565b34801561032957600080fd5b5061018f610d02565b34801561033e57600080fd5b506101f461034d3660046120c2565b610d11565b34801561035e57600080fd5b506101f461036d366004612323565b610dd6565b34801561037e57600080fd5b506101f461038d366004612047565b610e75565b34801561039e57600080fd5b5061018f6103ad36600461230a565b610ead565b3480156103be57600080fd5b506102a960075481565b3480156103d457600080fd5b506101bc6103e336600461230a565b6000908152600860205260409020546001600160a01b031690565b34801561040a57600080fd5b50610165610419366004611fd8565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561045357600080fd5b506101f4610462366004611fbd565b610f88565b60006001600160e01b031982166380ac58cd60e01b148061049857506001600160e01b03198216635b5e139f60e01b145b806104b357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546104c890612b32565b80601f01602080910402602001604051908101604052809291908181526020018280546104f490612b32565b80156105415780601f1061051657610100808354040283529160200191610541565b820191906000526020600020905b81548152906001019060200180831161052457829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166105c95760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006105f0826108c8565b9050806001600160a01b0316836001600160a01b0316141561065e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016105c0565b336001600160a01b038216148061067a575061067a8133610419565b6106ec5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016105c0565b6106f68383611023565b505050565b6107053382611091565b6107215760405162461bcd60e51b81526004016105c0906127f9565b6106f6838383611188565b6106f683838360405180602001604052806000815250610e75565b6006546001600160a01b031633146107715760405162461bcd60e51b81526004016105c090612773565b8051610784906009906020840190611e53565b5050565b84346107976020830183612a02565b90506107a38380612a02565b9050146107c25760405162461bcd60e51b81526004016105c090612915565b60005b6107d26020840184612a02565b90508161ffff1610156108385760006107ee6020850185612a02565b8361ffff1681811061080257610802612be4565b90506020020135116108265760405162461bcd60e51b81526004016105c09061271e565b8061083081612b67565b9150506107c5565b5060006108486020840184612a02565b905011806108565750600081115b6108725760405162461bcd60e51b81526004016105c0906128b8565b858585858083146108955760405162461bcd60e51b81526004016105c09061284a565b60006108a033611328565b90506108ad818d346113e5565b6108ba818c8c8c8c6115cd565b505050505050505050505050565b6000818152600260205260408120546001600160a01b0316806104b35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016105c0565b60006001600160a01b0382166109aa5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016105c0565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b031633146109f05760405162461bcd60e51b81526004016105c090612773565b6109fa6000611657565b565b8585610a0b6020830183612a02565b9050610a178380612a02565b905014610a365760405162461bcd60e51b81526004016105c090612915565b60005b610a466020840184612a02565b90508161ffff161015610aac576000610a626020850185612a02565b8361ffff16818110610a7657610a76612be4565b9050602002013511610a9a5760405162461bcd60e51b81526004016105c09061271e565b80610aa481612b67565b915050610a39565b506000610abc6020840184612a02565b90501180610aca5750600081115b610ae65760405162461bcd60e51b81526004016105c0906128b8565b85858585808314610b095760405162461bcd60e51b81526004016105c09061284a565b8c610b13816108c8565b6001600160a01b0316336001600160a01b031614610b435760405162461bcd60e51b81526004016105c0906127a8565b610b508e8c8c8c8c6115cd565b610b5b8e8e8e6116a9565b5050505050505050505050505050565b8434610b7a6020830183612a02565b9050610b868380612a02565b905014610ba55760405162461bcd60e51b81526004016105c090612915565b60005b610bb56020840184612a02565b90508161ffff161015610c1b576000610bd16020850185612a02565b8361ffff16818110610be557610be5612be4565b9050602002013511610c095760405162461bcd60e51b81526004016105c09061271e565b80610c1381612b67565b915050610ba8565b506000610c2b6020840184612a02565b90501180610c395750600081115b610c555760405162461bcd60e51b81526004016105c0906128b8565b85858585808314610c785760405162461bcd60e51b81526004016105c09061284a565b8b610c82816108c8565b6001600160a01b0316336001600160a01b031614610cb25760405162461bcd60e51b81526004016105c0906127a8565b6040517fec5edaa254eabbeb78800c10973d26937394311e5f63116baf1f5bc2ebb3d92590600090a1610ce68d8d346113e5565b610cf38d8c8c8c8c6115cd565b50505050505050505050505050565b6060600180546104c890612b32565b6001600160a01b038216331415610d6a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016105c0565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b83838383808314610df95760405162461bcd60e51b81526004016105c09061284a565b88610e03816108c8565b6001600160a01b0316336001600160a01b031614610e335760405162461bcd60e51b81526004016105c0906127a8565b6040517f098a5c64764c319df560b46daf95a5edaa4ffdd24a9bad5c9de976d41cfdfaeb90600090a1610e698a8a8a8a8a6115cd565b50505050505050505050565b610e7f3383611091565b610e9b5760405162461bcd60e51b81526004016105c0906127f9565b610ea7848484846117a4565b50505050565b6000818152600260205260409020546060906001600160a01b0316610f2c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016105c0565b6000610f366117d7565b90506000815111610f565760405180602001604052806000815250610f81565b80610f60846117e6565b604051602001610f71929190612555565b6040516020818303038152906040525b9392505050565b6006546001600160a01b03163314610fb25760405162461bcd60e51b81526004016105c090612773565b6001600160a01b0381166110175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105c0565b61102081611657565b50565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611058826108c8565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b031661110a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016105c0565b6000611115836108c8565b9050806001600160a01b0316846001600160a01b031614806111505750836001600160a01b03166111458461054b565b6001600160a01b0316145b8061118057506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661119b826108c8565b6001600160a01b0316146112035760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016105c0565b6001600160a01b0382166112655760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016105c0565b611270600082611023565b6001600160a01b0383166000908152600360205260408120805460019290611299908490612aef565b90915550506001600160a01b03821660009081526003602052604081208054600192906112c7908490612ac3565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000806113547f00000000000000000000000000000000000000000000000000000000000000006118e3565b60078054600081815260086020526040902080546001600160a01b0319166001600160a01b038516179055905491925090611390906001612ac3565b60075561139d8482611980565b604080518281526001600160a01b03841660208201527f827c603e5fad3c3ec77bf9b91a9ea99943aebb693ca8c9e838194bca5ffff0b2910160405180910390a19392505050565b60006113f96006546001600160a01b031690565b905060006114096103e884612adb565b9050816001600160a01b03168160405160006040518083038185875af1925050503d8060008114611456576040519150601f19603f3d011682016040523d82523d6000602084013e61145b565b606091505b5050506000858152600860205260409020546001600160a01b0316806114818386612aef565b604051600081818185875af1925050503d80600081146114bd576040519150601f19603f3d011682016040523d82523d6000602084013e6114c2565b606091505b50505060005b6114d28680612a02565b90508161ffff1610156115c4576103e86114ef6020880188612a02565b8361ffff1681811061150357611503612be4565b905060200201356115149190612adb565b9250611568611522886108c8565b858561152e8a80612a02565b8661ffff1681811061154257611542612be4565b90506020020160208101906115579190611fbd565b6001600160a01b031692919061199a565b6115b2611574886108c8565b838561158360208b018b612a02565b8661ffff1681811061159757611597612be4565b905060200201356115a89190612aef565b61152e8a80612a02565b806115bc81612b67565b9150506114c8565b50505050505050565b6000858152600860205260408120546001600160a01b031660405163d124b3b760e01b815290915081906001600160a01b0382169063d124b3b79061161c9089908990899089906004016125c1565b600060405180830381600087803b15801561163657600080fd5b505af115801561164a573d6000803e3d6000fd5b5050505050505050505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60606000806116cd866000908152600860205260409020546001600160a01b031690565b9050806001600160a01b031663642c438c86866116e98a6108c8565b6040518463ffffffff1660e01b815260040161170793929190612972565b600060405180830381600087803b15801561172157600080fd5b505af1158015611735573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261175d9190810190612123565b60405191945092507fb2d45cfa56b83d9af7e750bfaec5723ef33fb9cc10ae955cf6809e33a7ba57e4906117949085908590612671565b60405180910390a1505050505050565b6117af848484611188565b6117bb848484846119f4565b610ea75760405162461bcd60e51b81526004016105c0906126cc565b6060600980546104c890612b32565b60608161180a5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611834578061181e81612b89565b915061182d9050600a83612adb565b915061180e565b6000816001600160401b0381111561184e5761184e612bfa565b6040519080825280601f01601f191660200182016040528015611878576020820181803683370190505b5090505b84156111805761188d600183612aef565b915061189a600a86612ba4565b6118a5906030612ac3565b60f81b8183815181106118ba576118ba612be4565b60200101906001600160f81b031916908160001a9053506118dc600a86612adb565b945061187c565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b03811661197b5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b60448201526064016105c0565b919050565b610784828260405180602001604052806000815250611b01565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ea7908590611b34565b60006001600160a01b0384163b15611af657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611a38903390899088908890600401612584565b602060405180830381600087803b158015611a5257600080fd5b505af1925050508015611a82575060408051601f3d908101601f19168201909252611a7f91810190612211565b60015b611adc573d808015611ab0576040519150601f19603f3d011682016040523d82523d6000602084013e611ab5565b606091505b508051611ad45760405162461bcd60e51b81526004016105c0906126cc565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611180565b506001949350505050565b611b0b8383611c06565b611b1860008484846119f4565b6106f65760405162461bcd60e51b81526004016105c0906126cc565b6000611b89826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611d489092919063ffffffff16565b8051909150156106f65780806020019051810190611ba791906121d7565b6106f65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105c0565b6001600160a01b038216611c5c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016105c0565b6000818152600260205260409020546001600160a01b031615611cc15760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016105c0565b6001600160a01b0382166000908152600360205260408120805460019290611cea908490612ac3565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060611180848460008585843b611da15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105c0565b600080866001600160a01b03168587604051611dbd9190612539565b60006040518083038185875af1925050503d8060008114611dfa576040519150601f19603f3d011682016040523d82523d6000602084013e611dff565b606091505b5091509150611e0f828286611e1a565b979650505050505050565b60608315611e29575081610f81565b825115611e395782518084602001fd5b8160405162461bcd60e51b81526004016105c091906126b9565b828054611e5f90612b32565b90600052602060002090601f016020900481019282611e815760008555611ec7565b82601f10611e9a57805160ff1916838001178555611ec7565b82800160010185558215611ec7579182015b82811115611ec7578251825591602001919060010190611eac565b50611ed3929150611ed7565b5090565b5b80821115611ed35760008155600101611ed8565b60006001600160401b03831115611f0557611f05612bfa565b611f18601f8401601f1916602001612a4b565b9050828152838383011115611f2c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461197b57600080fd5b60008083601f840112611f6c57600080fd5b5081356001600160401b03811115611f8357600080fd5b6020830191508360208260051b8501011115611f9e57600080fd5b9250929050565b600060408284031215611fb757600080fd5b50919050565b600060208284031215611fcf57600080fd5b610f8182611f43565b60008060408385031215611feb57600080fd5b611ff483611f43565b915061200260208401611f43565b90509250929050565b60008060006060848603121561202057600080fd5b61202984611f43565b925061203760208501611f43565b9150604084013590509250925092565b6000806000806080858703121561205d57600080fd5b61206685611f43565b935061207460208601611f43565b92506040850135915060608501356001600160401b0381111561209657600080fd5b8501601f810187136120a757600080fd5b6120b687823560208401611eec565b91505092959194509250565b600080604083850312156120d557600080fd5b6120de83611f43565b915060208301356120ee81612c10565b809150509250929050565b6000806040838503121561210c57600080fd5b61211583611f43565b946020939093013593505050565b6000806040838503121561213657600080fd5b82516001600160401b038082111561214d57600080fd5b818501915085601f83011261216157600080fd5b815160208282111561217557612175612bfa565b8160051b9250612186818401612a4b565b8281528181019085830185870184018b10156121a157600080fd5b600096505b848710156121c45780518352600196909601959183019183016121a6565b5097909101519698969750505050505050565b6000602082840312156121e957600080fd5b8151610f8181612c10565b60006020828403121561220657600080fd5b8135610f8181612c1e565b60006020828403121561222357600080fd5b8151610f8181612c1e565b60006020828403121561224057600080fd5b81356001600160401b0381111561225657600080fd5b8201601f8101841361226757600080fd5b61118084823560208401611eec565b60008060008060006060868803121561228e57600080fd5b85356001600160401b03808211156122a557600080fd5b6122b189838a01611fa5565b965060208801359150808211156122c757600080fd5b6122d389838a01611f5a565b909650945060408801359150808211156122ec57600080fd5b506122f988828901611f5a565b969995985093965092949392505050565b60006020828403121561231c57600080fd5b5035919050565b60008060008060006060868803121561233b57600080fd5b8535945060208601356001600160401b03808211156122c757600080fd5b6000806000806000806080878903121561237257600080fd5b8635955060208701356001600160401b038082111561239057600080fd5b61239c8a838b01611fa5565b965060408901359150808211156123b257600080fd5b6123be8a838b01611f5a565b909650945060608901359150808211156123d757600080fd5b506123e489828a01611f5a565b979a9699509497509295939492505050565b600080600080600080600060a0888a03121561241157600080fd5b8735965060208801356001600160401b038082111561242f57600080fd5b61243b8b838c01611fa5565b975060408a0135965060608a013591508082111561245857600080fd5b6124648b838c01611f5a565b909650945060808a013591508082111561247d57600080fd5b5061248a8a828b01611f5a565b989b979a50959850939692959293505050565b8183526000602080850194508260005b858110156124d9576001600160a01b036124c683611f43565b16875295820195908201906001016124ad565b509495945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452612525816020860160208601612b06565b601f01601f19169290920160200192915050565b6000825161254b818460208701612b06565b9190910192915050565b60008351612567818460208801612b06565b83519083019061257b818360208801612b06565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906125b79083018461250d565b9695505050505050565b6040815260006125d560408301868861249d565b602083820381850152818583528183019050818660051b8401018760005b8881101561266157858303601f190184528135368b9003601e1901811261261957600080fd5b8a0180356001600160401b0381111561263157600080fd5b8036038c131561264057600080fd5b61264d85828985016124e4565b9587019594505050908401906001016125f3565b50909a9950505050505050505050565b604080825283519082018190526000906020906060840190828701845b828110156126aa5781518452928401929084019060010161268e565b50505092019290925292915050565b602081526000610f81602083018461250d565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526035908201527f444546494241534b45542057414c4c45543a20455243323020544f4b454e204160408201527404d4f554e5453204e45454420544f204245203e203605c1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f444546494241534b45543a204f4e4c59204e4654204f574e45522043414e204360408201527020a626102a2424a990232aa721aa24a7a760791b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526048908201527f444546494241534b45543a2042524944474520454e434f4445442043414c4c5360408201527f20414e4420414444524553534553204d5553542048415645205448452053414d60608201526708a40988a9c8ea8960c31b608082015260a00190565b60208082526038908201527f444546494241534b45543a20414e20414d4f554e5420494e204554484552204f60408201527f5220455243323020544f4b454e53204953204e45454445440000000000000000606082015260800190565b60208082526039908201527f444546494241534b45543a204d49534d4154434820494e204c454e475448204260408201527f45545745454e20544f4b454e5320414e4420414d4f554e545300000000000000606082015260800190565b6060815260006129828586612a7b565b6040606085015261299760a08501828461249d565b9150506129a76020870187612a7b565b848303605f190160808601528083526001600160fb1b038111156129ca57600080fd5b60051b808260208501376000920160209081019283528401959095526001600160a01b03939093166040909201919091525092915050565b6000808335601e19843603018112612a1957600080fd5b8301803591506001600160401b03821115612a3357600080fd5b6020019150600581901b3603821315611f9e57600080fd5b604051601f8201601f191681016001600160401b0381118282101715612a7357612a73612bfa565b604052919050565b6000808335601e19843603018112612a9257600080fd5b83016020810192503590506001600160401b03811115612ab157600080fd5b8060051b3603831315611f9e57600080fd5b60008219821115612ad657612ad6612bb8565b500190565b600082612aea57612aea612bce565b500490565b600082821015612b0157612b01612bb8565b500390565b60005b83811015612b21578181015183820152602001612b09565b83811115610ea75750506000910152565b600181811c90821680612b4657607f821691505b60208210811415611fb757634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415612b7f57612b7f612bb8565b6001019392505050565b6000600019821415612b9d57612b9d612bb8565b5060010190565b600082612bb357612bb3612bce565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461102057600080fd5b6001600160e01b03198116811461102057600080fdfea26469706673582212202848aa60643eeef72a3a828544f71e17a313fc95ce748089ed4b77cebeeb732564736f6c6343000806003360a060405234801561001057600080fd5b5033606081901b608052610b9a6100386000396000818160d0015261039b0152610b9a6000f3fe60806040526004361061002d5760003560e01c8063642c438c14610071578063d124b3b7146100a857600080fd5b3661006c57604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a1005b600080fd5b34801561007d57600080fd5b5061009161008c366004610885565b6100ca565b60405161009f929190610926565b60405180910390f35b3480156100b457600080fd5b506100c86100c33660046107f7565b610399565b005b606060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331461011f5760405162461bcd60e51b8152600401610116906109a1565b60405180910390fd5b600061012b86806109fe565b905067ffffffffffffffff81111561014557610145610b4e565b60405190808252806020026020018201604052801561016e578160200160208202803683370190505b50905060005b61017e87806109fe565b90508161ffff16101561031657620186a061019c60208901896109fe565b8361ffff168181106101b0576101b0610b38565b602002919091013590506101c489806109fe565b8461ffff168181106101d8576101d8610b38565b90506020020160208101906101ed91906107dc565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b15801561022e57600080fd5b505afa158015610242573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061026691906108e1565b6102709190610ab1565b61027a9190610a8f565b828261ffff168151811061029057610290610b38565b60200260200101818152505061030485838361ffff16815181106102b6576102b6610b38565b60209081029190910101516102cb8a806109fe565b8561ffff168181106102df576102df610b38565b90506020020160208101906102f491906107dc565b6001600160a01b031691906104d1565b8061030e81610b00565b915050610174565b506000851561038d57620186a061032d8747610ab1565b6103379190610a8f565b9050846001600160a01b03168160405160006040518083038185875af1925050503d8060008114610384576040519150601f19603f3d011682016040523d82523d6000602084013e610389565b606091505b5050505b90969095509350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146103e15760405162461bcd60e51b8152600401610116906109a1565b6000606060005b61ffff81168611156104c85786868261ffff1681811061040a5761040a610b38565b905060200201602081019061041f91906107dc565b6001600160a01b031685858361ffff1681811061043e5761043e610b38565b90506020028101906104509190610a48565b60405161045e9291906108fa565b600060405180830381855af49150503d8060008114610499576040519150601f19603f3d011682016040523d82523d6000602084013e61049e565b606091505b509093509150826104b6576040513d806000833e8082fd5b806104c081610b00565b9150506103e8565b50505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610523908490610528565b505050565b600061057d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166105fa9092919063ffffffff16565b805190915015610523578080602001905181019061059b9190610863565b6105235760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610116565b60606106098484600085610613565b90505b9392505050565b6060824710156106745760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610116565b843b6106c25760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610116565b600080866001600160a01b031685876040516106de919061090a565b60006040518083038185875af1925050503d806000811461071b576040519150601f19603f3d011682016040523d82523d6000602084013e610720565b606091505b509150915061073082828661073b565b979650505050505050565b6060831561074a57508161060c565b82511561075a5782518084602001fd5b8160405162461bcd60e51b8152600401610116919061096e565b80356001600160a01b038116811461078b57600080fd5b919050565b60008083601f8401126107a257600080fd5b50813567ffffffffffffffff8111156107ba57600080fd5b6020830191508360208260051b85010111156107d557600080fd5b9250929050565b6000602082840312156107ee57600080fd5b61060c82610774565b6000806000806040858703121561080d57600080fd5b843567ffffffffffffffff8082111561082557600080fd5b61083188838901610790565b9096509450602087013591508082111561084a57600080fd5b5061085787828801610790565b95989497509550505050565b60006020828403121561087557600080fd5b8151801515811461060c57600080fd5b60008060006060848603121561089a57600080fd5b833567ffffffffffffffff8111156108b157600080fd5b8401604081870312156108c357600080fd5b9250602084013591506108d860408501610774565b90509250925092565b6000602082840312156108f357600080fd5b5051919050565b8183823760009101908152919050565b6000825161091c818460208701610ad0565b9190910192915050565b604080825283519082018190526000906020906060840190828701845b8281101561095f57815184529284019290840190600101610943565b50505092019290925292915050565b602081526000825180602084015261098d816040850160208701610ad0565b601f01601f19169190910160400192915050565b6020808252603b908201527f57414c4c45543a204f4e4c592054484520444546494241534b455420434f4e5460408201527f524143542043414e2043414c4c20544849532046554e4354494f4e0000000000606082015260800190565b6000808335601e19843603018112610a1557600080fd5b83018035915067ffffffffffffffff821115610a3057600080fd5b6020019150600581901b36038213156107d557600080fd5b6000808335601e19843603018112610a5f57600080fd5b83018035915067ffffffffffffffff821115610a7a57600080fd5b6020019150368190038213156107d557600080fd5b600082610aac57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610acb57610acb610b22565b500290565b60005b83811015610aeb578181015183820152602001610ad3565b83811115610afa576000848401525b50505050565b600061ffff80831681811415610b1857610b18610b22565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212201b47d25559b2bbb1b6e83a59af601f2ed0c146b09a00ebff5fdd0684398a492364736f6c6343000806003368747470733a2f2f7777772e646566696261736b65742e6f72672f6170692f6765742d6e66742d6d657461646174612f
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.