Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
VeArtProxy
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 100000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { Base64 } from "./libraries/Base64.sol"; import { IVeArtProxy } from "./interfaces/IVeArtProxy.sol"; /// @title VeArtProxy /// @author Rings Protocol /// @notice VeArtProxy is a contract for generating SVG images for VeArt NFTs /// it is a fork of Thena's VeArtProxy contract contract VeArtProxy is IVeArtProxy { /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor() { } /*////////////////////////////////////////////////////////////// VIEW FUNCTIONS //////////////////////////////////////////////////////////////*/ /** * @notice Returns the SVG image for a given token * @param _tokenId The token ID * @param _balanceOf The balance of the token * @param _locked_end The end of the lock period * @param _value The value of the token * @return output The SVG image */ function _tokenURI(uint256 _tokenId, uint256 _balanceOf, uint256 _locked_end, uint256 _value) external pure returns (string memory output) { output = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">'; output = string(abi.encodePacked(output, "token ", toString(_tokenId), '</text><text x="10" y="40" class="base">')); output = string( abi.encodePacked(output, "balanceOf ", toString(_balanceOf), '</text><text x="10" y="60" class="base">') ); output = string( abi.encodePacked(output, "locked_end ", toString(_locked_end), '</text><text x="10" y="80" class="base">') ); output = string(abi.encodePacked(output, "value ", toString(_value), "</text></svg>")); string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "lock #', toString(_tokenId), '", "description": "Rings locks, can be used to boost gauge yields, vote on token emission, and receive bribes", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}' ) ) ) ); output = string(abi.encodePacked("data:application/json;base64,", json)); } /*////////////////////////////////////////////////////////////// INTERNAL FUNCTIONS //////////////////////////////////////////////////////////////*/ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT license // 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); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.24; interface IVeArtProxy { function _tokenURI(uint256 _tokenId, uint256 _balanceOf, uint256 _locked_end, uint256 _value) external pure returns (string memory output); }
{ "remappings": [ "ds-test/=lib/solmate/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "solmate/=lib/solmate/src/", "solady/=lib/solady/src/", "src/=src/", "test/=test/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 100000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_balanceOf","type":"uint256"},{"internalType":"uint256","name":"_locked_end","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"_tokenURI","outputs":[{"internalType":"string","name":"output","type":"string"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
6080806040523461001657610bb9908161001c8239f35b600080fdfe604060808152600436101561001357600080fd5b60003560e01c63dd9ec1491461002857600080fd5b346104ac5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104ac576004359061006361060d565b9161006d816108c1565b8251809160209586830161008091610763565b7f746f6b656e20000000000000000000000000000000000000000000000000000081526006016100af91610763565b7f3c2f746578743e3c7465787420783d2231302220793d2234302220636c61737381527f3d2262617365223e000000000000000000000000000000000000000000000000602082015260280103917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe092838101835261012e908361056e565b6101396024356108c1565b91845192839187830161014b91610763565b7f62616c616e63654f6620000000000000000000000000000000000000000000008152600a0161017a91610763565b7f3c2f746578743e3c7465787420783d2231302220793d2236302220636c61737381527f3d2262617365223e00000000000000000000000000000000000000000000000060208201526028010383810183526101d6908361056e565b6101e16044356108c1565b9184519283918783016101f391610763565b7f6c6f636b65645f656e64200000000000000000000000000000000000000000008152600b0161022291610763565b7f3c2f746578743e3c7465787420783d2231302220793d2238302220636c61737381527f3d2262617365223e000000000000000000000000000000000000000000000000602082015260280103838101835261027e908361056e565b6102896064356108c1565b91845192839187830161029b91610763565b7f76616c756520000000000000000000000000000000000000000000000000000081526006016102ca91610763565b7f3c2f746578743e3c2f7376673e000000000000000000000000000000000000008152600d01038381018352610300908361056e565b610309906108c1565b9061031390610a3b565b83517f7b226e616d65223a20226c6f636b202300000000000000000000000000000000868201908152909283929160100161034d91610763565b7f222c20226465736372697074696f6e223a202252696e6773206c6f636b732c2081527f63616e206265207573656420746f20626f6f7374206761756765207969656c6460208201527f732c20766f7465206f6e20746f6b656e20656d697373696f6e2c20616e64207260408201527f65636569766520627269626573222c2022696d616765223a2022646174613a6960608201527f6d6167652f7376672b786d6c3b6261736536342c000000000000000000000000608082015260940161041491610763565b7f227d000000000000000000000000000000000000000000000000000000000000815260020103828101825261044a908261056e565b61045390610a3b565b82517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000094810194855293849190601d0161048c91610763565b03908101835261049c908361056e565b516104a88192826104d4565b0390f35b600080fd5b60005b8381106104c45750506000910152565b81810151838201526020016104b4565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6040936020845261051781518092816020880152602088880191016104b1565b0116010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761056957604052565b61051e565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761056957604052565b67ffffffffffffffff811161056957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b604051906020820182811067ffffffffffffffff8211176105695760405260008252565b60405190610120820182811067ffffffffffffffff8211176105695760405260fd82527f7420783d2231302220793d2232302220636c6173733d2262617365223e000000610100837f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323060208201527f30302f73766722207072657365727665417370656374526174696f3d22784d6960408201527f6e594d696e206d656574222076696577426f783d22302030203335302033353060608201527f223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f60808201527f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a2031347060a08201527f783b207d3c2f7374796c653e3c726563742077696474683d223130302522206860c08201527f65696768743d2231303025222066696c6c3d22626c61636b22202f3e3c74657860e08201520152565b90610776602092828151948592016104b1565b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d65760010190565b61077a565b906107e5826105af565b6107f2604051918261056e565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061082082946105af565b0190602036910137565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182116107d657565b60300190816030116107d657565b90600282018092116107d657565b90602082018092116107d657565b908151811015610892570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8015610961576000818181805b61094957506108dc816107db565b935b6108e85750505090565b6108f19061082a565b90600a9061093461090c610906848406610857565b60ff1690565b60f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b841a6109408487610881565b530490816108de565b9150610956600a916107a9565b9104808492916108ce565b5060405161096e8161054d565b600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b908160021b917f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8116036107d657565b604051906060820182811067ffffffffffffffff82111761056957604052604082527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f6040837f4142434445464748494a4b4c4d4e4f505152535455565758595a61626364656660208201520152565b8051908115610b9f57610a5f610a5a610a5384610865565b6003900490565b61099b565b91610a71610a6c84610873565b6107db565b90610a7a6109cb565b92600092602081015b8484811015610ae7579060049160038091019685010151600180603f81818560121c168c0101518b60089160ff9586918282878b600c1c16860101511690851b01841b92858960061c160101511601901b93168a010151160160e01b815201610a83565b509350949350506003900680600114610b5357600214610b08575b50815290565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f3d0000000000000000000000000000000000000000000000000000000000000091015238610b02565b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f3d3d00000000000000000000000000000000000000000000000000000000000091015238610b02565b5050610ba96105e9565b9056fea164736f6c6343000818000a
Deployed Bytecode
0x604060808152600436101561001357600080fd5b60003560e01c63dd9ec1491461002857600080fd5b346104ac5760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104ac576004359061006361060d565b9161006d816108c1565b8251809160209586830161008091610763565b7f746f6b656e20000000000000000000000000000000000000000000000000000081526006016100af91610763565b7f3c2f746578743e3c7465787420783d2231302220793d2234302220636c61737381527f3d2262617365223e000000000000000000000000000000000000000000000000602082015260280103917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe092838101835261012e908361056e565b6101396024356108c1565b91845192839187830161014b91610763565b7f62616c616e63654f6620000000000000000000000000000000000000000000008152600a0161017a91610763565b7f3c2f746578743e3c7465787420783d2231302220793d2236302220636c61737381527f3d2262617365223e00000000000000000000000000000000000000000000000060208201526028010383810183526101d6908361056e565b6101e16044356108c1565b9184519283918783016101f391610763565b7f6c6f636b65645f656e64200000000000000000000000000000000000000000008152600b0161022291610763565b7f3c2f746578743e3c7465787420783d2231302220793d2238302220636c61737381527f3d2262617365223e000000000000000000000000000000000000000000000000602082015260280103838101835261027e908361056e565b6102896064356108c1565b91845192839187830161029b91610763565b7f76616c756520000000000000000000000000000000000000000000000000000081526006016102ca91610763565b7f3c2f746578743e3c2f7376673e000000000000000000000000000000000000008152600d01038381018352610300908361056e565b610309906108c1565b9061031390610a3b565b83517f7b226e616d65223a20226c6f636b202300000000000000000000000000000000868201908152909283929160100161034d91610763565b7f222c20226465736372697074696f6e223a202252696e6773206c6f636b732c2081527f63616e206265207573656420746f20626f6f7374206761756765207969656c6460208201527f732c20766f7465206f6e20746f6b656e20656d697373696f6e2c20616e64207260408201527f65636569766520627269626573222c2022696d616765223a2022646174613a6960608201527f6d6167652f7376672b786d6c3b6261736536342c000000000000000000000000608082015260940161041491610763565b7f227d000000000000000000000000000000000000000000000000000000000000815260020103828101825261044a908261056e565b61045390610a3b565b82517f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000094810194855293849190601d0161048c91610763565b03908101835261049c908361056e565b516104a88192826104d4565b0390f35b600080fd5b60005b8381106104c45750506000910152565b81810151838201526020016104b4565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f6040936020845261051781518092816020880152602088880191016104b1565b0116010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040810190811067ffffffffffffffff82111761056957604052565b61051e565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761056957604052565b67ffffffffffffffff811161056957601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b604051906020820182811067ffffffffffffffff8211176105695760405260008252565b60405190610120820182811067ffffffffffffffff8211176105695760405260fd82527f7420783d2231302220793d2232302220636c6173733d2262617365223e000000610100837f3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323060208201527f30302f73766722207072657365727665417370656374526174696f3d22784d6960408201527f6e594d696e206d656574222076696577426f783d22302030203335302033353060608201527f223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f60808201527f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a2031347060a08201527f783b207d3c2f7374796c653e3c726563742077696474683d223130302522206860c08201527f65696768743d2231303025222066696c6c3d22626c61636b22202f3e3c74657860e08201520152565b90610776602092828151948592016104b1565b0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d65760010190565b61077a565b906107e5826105af565b6107f2604051918261056e565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe061082082946105af565b0190602036910137565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82019182116107d657565b60300190816030116107d657565b90600282018092116107d657565b90602082018092116107d657565b908151811015610892570160200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8015610961576000818181805b61094957506108dc816107db565b935b6108e85750505090565b6108f19061082a565b90600a9061093461090c610906848406610857565b60ff1690565b60f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b841a6109408487610881565b530490816108de565b9150610956600a916107a9565b9104808492916108ce565b5060405161096e8161054d565b600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b908160021b917f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8116036107d657565b604051906060820182811067ffffffffffffffff82111761056957604052604082527f6768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f6040837f4142434445464748494a4b4c4d4e4f505152535455565758595a61626364656660208201520152565b8051908115610b9f57610a5f610a5a610a5384610865565b6003900490565b61099b565b91610a71610a6c84610873565b6107db565b90610a7a6109cb565b92600092602081015b8484811015610ae7579060049160038091019685010151600180603f81818560121c168c0101518b60089160ff9586918282878b600c1c16860101511690851b01841b92858960061c160101511601901b93168a010151160160e01b815201610a83565b509350949350506003900680600114610b5357600214610b08575b50815290565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f3d0000000000000000000000000000000000000000000000000000000000000091015238610b02565b507ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe7f3d3d00000000000000000000000000000000000000000000000000000000000091015238610b02565b5050610ba96105e9565b9056fea164736f6c6343000818000a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.