Skip to content

Commit

Permalink
ve svg
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Jan 18, 2024
1 parent 39e3218 commit 9d8b203
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ forge fmt
* veSTGN proxy 0x87eDeA5aea52BA12Ebf4eBc253Ec3218C1090C70
* Multigauge 0xAf95468B1a624605bbFb862B0FB6e9C73Ad847b8
* Factory 0xBD5296DC2603942F116B375c8Ee373674be86f56
* VeDistributor proxy 0x7c8d0C7B63249A314df84707F8690F62CF625820
* MockGauge 0x54F22378E03BeA25a05A071b60357d31Ce535Bb9
* MockLiquidator 0x97B56FEAdA7fb2D7A0A8576635f05314f184f0C2
* MockA 0xBcA14CF8Cc2417a5B4ed242bA45aE4835aF4d5Df
Expand Down
21 changes: 14 additions & 7 deletions src/lib/VeSTGNLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -374,38 +374,45 @@ library VeSTGNLib {
uint untilEnd,
uint _value
) public pure returns (string memory output) {
output =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 900"><style>.base{font-size:40px;}</style><rect fill="#193180" width="600" height="900"/><path fill="#4899F8" d="M0,900h600V522.2C454.4,517.2,107.4,456.8,60.2,0H0V900z"/><circle fill="#1B184E" cx="385" cy="212" r="180"/><circle fill="#04A8F0" cx="385" cy="142" r="42"/><path fill-rule="evenodd" clip-rule="evenodd" fill="#686DF1" d="M385.6,208.8c43.1,0,78-34.9,78-78c-1.8-21.1,16.2-21.1,21.1-15.4c0.4,0.3,0.7,0.7,1.1,1.2c16.7,21.5,26.6,48.4,26.6,77.7c0,25.8-24.4,42.2-50.2,42.2H309c-25.8,0-50.2-16.4-50.2-42.2c0-29.3,9.9-56.3,26.6-77.7c0.3-0.4,0.7-0.8,1.1-1.2c4.9-5.7,22.9-5.7,21.1,15.4l0,0C307.6,173.9,342.5,208.8,385.6,208.8z"/><path fill="#04A8F0" d="M372.3,335.9l-35.5-51.2c-7.5-10.8,0.2-25.5,13.3-25.5h35.5h35.5c13.1,0,20.8,14.7,13.3,25.5l-35.5,51.2C392.5,345.2,378.7,345.2,372.3,335.9z"/>';
output = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2406.2 3609.2" style="enable-background:new 0 0 2406.2 3609.2;" xml:space="preserve"><style>.st0 {fill:#101035;}.st1 {fill:#5E78F7;}.st2 {font-family:"TimesNewRomanPS-BoldMT";}.st3 {font-size:189px;}.st4 {fill:#FFFFFF;}.st5 {font-family:"TimesNewRomanPSMT";}.st6 {font-size:164.1369px;}.st7 {fill:#212E6D;}.st8 {fill:#3D68D3;}</style><rect class="st0" width="2406.2" height="3609.2"/>';

output = string(
abi.encodePacked(
output,
'<text transform="matrix(1 0 0 1 50 464)" fill="#EAECFE" class="base">ID:</text><text transform="matrix(1 0 0 1 50 506)" fill="#97D0FF" class="base">',
'<text transform="matrix(1 0 0 1 201.4935 1860.8424)" class="st1 st2 st3">ID:</text><text transform="matrix(1 0 0 1 201.4935 2029.2721)" class="st4 st5 st6">',
_u2s(_tokenId),
"</text>"
)
);
output = string(
abi.encodePacked(
output,
'<text transform="matrix(1 0 0 1 50 579)" fill="#EAECFE" class="base">Balance:</text><text transform="matrix(1 0 0 1 50 621)" fill="#97D0FF" class="base">',
'<text transform="matrix(1 0 0 1 201.4935 2325.1277)" class="st1 st2 st3">Balance:</text><text transform="matrix(1 0 0 1 201.4935 2493.5593)" class="st4 st5 st6">',
_u2s(_balanceOf / 1e18),
"</text>"
)
);
output = string(
abi.encodePacked(
output,
'<text transform="matrix(1 0 0 1 50 695)" fill="#EAECFE" class="base">Until unlock:</text><text transform="matrix(1 0 0 1 50 737)" fill="#97D0FF" class="base">',
'<text transform="matrix(1 0 0 1 201.4935 2789.4148)" class="st1 st2 st3">Locked end:</text><text transform="matrix(1 0 0 1 201.4935 2957.8464)" class="st4 st5 st6">',
_u2s(untilEnd / 60 / 60 / 24),
" days</text>"
)
);
output = string(
abi.encodePacked(
output,
'<text transform="matrix(1 0 0 1 50 811)" fill="#EAECFE" class="base">Power:</text><text transform="matrix(1 0 0 1 50 853)" fill="#97D0FF" class="base">',
'<text transform="matrix(1 0 0 1 201.4935 3253.7)" class="st1 st2 st3">Value:</text><text transform="matrix(1 0 0 1 201.4935 3422.1316)" class="st4 st5 st6">',
_u2s(_value / 1e18),
"</text></svg>"
"</text>"
)
);

output = string(
abi.encodePacked(
output,
'<g><circle class="st0" cx="1501.6" cy="901" r="762.5"/><path class="st7" d="M1201,331.2c-9.6,0-18.8-5.3-23.4-14.4c-6.5-12.9-1.3-28.7,11.6-35.2c47.5-24,97.7-42.5,149.3-54.9 c53.1-12.8,108-19.3,163.1-19.3c54.9,0,109.6,6.4,162.5,19.1c51.4,12.3,101.5,30.7,148.8,54.5c12.9,6.5,18.1,22.3,11.6,35.2 c-6.5,12.9-22.3,18.1-35.2,11.6c-43.7-22-90-38.9-137.5-50.3c-48.9-11.7-99.4-17.7-150.2-17.7c-51,0-101.8,6-150.9,17.8 c-47.7,11.5-94.1,28.6-138,50.7C1209,330.3,1205,331.2,1201,331.2z"/> <path class="st1" d="M1501.6,1594.7c-93.6,0-184.5-18.3-270-54.5c-82.6-34.9-156.8-84.9-220.5-148.6S897.4,1253.6,862.5,1171 c-36.2-85.5-54.5-176.4-54.5-270c0-56.7,6.9-113,20.4-167.5c13.1-52.9,32.6-104.4,57.9-152.8c49.5-95,121.6-178.5,208.5-241.5 c11.7-8.5,28.1-5.9,36.6,5.8c8.5,11.7,5.9,28.1-5.8,36.6c-80.4,58.3-147,135.5-192.8,223.3c-23.3,44.8-41.3,92.3-53.5,141.2 c-12.5,50.4-18.8,102.5-18.8,154.9c0,86.6,17,170.6,50.4,249.6c32.3,76.4,78.5,144.9,137.4,203.8s127.5,105.1,203.8,137.4 c79,33.4,163,50.4,249.6,50.4s170.6-17,249.6-50.4c76.4-32.3,144.9-78.5,203.8-137.4c58.9-58.9,105.1-127.5,137.4-203.8 c33.4-79,50.4-163,50.4-249.6c0-52.3-6.3-104.3-18.7-154.6c-12.1-48.8-30-96.2-53.2-140.9c-45.6-87.6-112-164.8-192-223.1 c-11.7-8.5-14.3-24.9-5.7-36.6c8.5-11.7,24.9-14.3,36.6-5.7c86.5,63.1,158.3,146.5,207.6,241.3c25.2,48.4,44.5,99.7,57.6,152.5 c13.5,54.4,20.3,110.6,20.3,167.2c0,93.6-18.3,184.5-54.5,270c-34.9,82.6-84.9,156.8-148.6,220.5s-137.9,113.7-220.5,148.6 C1686.1,1576.3,1595.2,1594.7,1501.6,1594.7z"/> <path class="st8" d="M1650.9,1524.8c15.2,10.4,37.8,25.8,56.9,38.7c21.6-6.7,42.9-14.5,63.9-23.4c20.7-8.7,41-18.5,60.8-29.3 c-9.4-12.3-19.9-27.1-30.1-43.3c-16.7,8.9-33.8,17-51.1,24.4C1718.6,1505.7,1685.1,1516.7,1650.9,1524.8z"/> <g> <path class="st7" d="M1226.2,712.5c8.5-7.8,18.6-14.8,29.9-21.1c-1.1,22.4,1.6,48.5,12.2,75.7c30.7,79,63.2,117.2,94.3,117.8 c13.6,0.3,64.8-15.8,105.5-14c40.7,1.8,26.2,17.1,7.9,28.9c-18.3,11.8-6,35.9,34.1,60.1s64.3,10.6,95.6,0 c31.3-10.6,55.3-17.1,44.2-2.4c-11.1,14.8-41.8,34.2-41.2,55.4c0.6,21.2,21.7,92,50.9,117c9.1,7.8-27.9,11.2-74.5-44.8 s-44.2-117.4-131.6-112c-87.3,5.3-36,69-44.8,76.7c-8.8,7.7-43.8-36.4-61.5-70c-8.8-16.8-11.3-39.4-22.9-49.8s-44-18.4-60.2-23.2 c-61.3-18.5-85.3-50.3-85.3-50.3S1152,780.5,1226.2,712.5z"/> <path class="st7" d="M1777,1089.5c-8.5,7.8-18.6,14.8-29.9,21.1c1.1-22.4-1.6-48.5-12.2-75.7c-30.7-79-63.2-117.2-94.3-117.8 c-13.6-0.3-64.8,15.8-105.5,14c-40.7-1.8-26.2-17.1-7.9-28.9c18.3-11.8,6-35.9-34.1-60.1c-40.1-24.2-64.3-10.6-95.6,0 c-31.3,10.6-55.3,17.1-44.2,2.4c11.1-14.8,41.8-34.2,41.2-55.4c-0.6-21.2-21.7-92-50.9-117c-9.1-7.8,27.9-11.2,74.5,44.8 s44.2,117.4,131.6,112c87.3-5.3,36-69,44.8-76.7c8.8-7.7,43.8,36.4,61.5,70c8.8,16.8,11.3,39.4,22.9,49.8 c11.6,10.4,44,18.4,60.2,23.2c61.3,18.5,85.3,50.3,85.3,50.3S1851.2,1021.5,1777,1089.5z"/> <path class="st1" d="M1880.1,1267.3c-40.4,85.7-89,106.2-146.3,131.1c-57.3,24.9-103,25.6-105.6,27.2c-2.6,1.5,2.1,4.1,19.7,7.9 c17.6,3.8,34.5,0.3,59.5-1.2c25-1.6,55.7,28.9,82.1,75.6c26.4,46.7,42.2,48.6,35.3,59c-6.9,10.3-25.3,9.9-81-17.5 c-55.7-27.4-66.3-46.2-105.7-78.8c-39.4-32.6-28.6-26.4-86.1-22.3c-57.5,4.2-170.1-9.8-271.6-45.5 c-101.5-35.7-176.3-78.6-176.3-90.8c0-12.2,24.7-7,52.4-7.4c27.7-0.4,65.3-24.3,125.2-64.5c1-0.7,2-1.3,3-2 c45.5-36.9,94.7-74.2,109.9-85.6c2.9-2.2,6.8-2.6,10-1l40.8,19.7c3.3,1.6,7.3,1.2,10.2-1.1l30.6-23.9c2.9-2.3,6.8-2.7,10.1-1.1 l33.4,15.8c3.3,1.5,7.1,1.1,10-1l32.5-24.7c2.8-2.1,6.5-2.6,9.7-1.2l35.1,15.4c3.2,1.4,6.9,1,9.7-1.1l27.3-20.5 c2.5-1.9,5.8-2.5,8.8-1.5c6.3,2.1,17.5,5.7,25.5,7.4c1.7,0.4,3.4,0.2,5.1-0.3c19.6-6.4,37.8-14,53.7-22.9 c11.3-6.3,21.4-13.3,29.9-21.1c74.2-68,47.3-144,47.3-144C1929.1,1074.5,1899.3,1226.4,1880.1,1267.3z"/> <path class="st1" d="M1123.2,534.8c40.4-85.7,89-106.2,146.3-131.1c57.3-24.9,103-25.6,105.6-27.2c2.6-1.5-2.1-4.1-19.7-7.9 c-17.6-3.8-34.5-0.3-59.5,1.2c-25,1.6-55.7-28.9-82.1-75.6c-26.4-46.7-42.2-48.6-35.3-59c6.9-10.3,25.3-9.9,81,17.5 c55.7,27.4,66.3,46.2,105.7,78.8c39.4,32.6,28.6,26.4,86.1,22.3c57.5-4.2,170.1,9.8,271.6,45.5c101.5,35.7,176.3,78.6,176.3,90.8 c0,12.2-24.7,7-52.4,7.4c-27.7,0.4-65.3,24.3-125.2,64.5c-1,0.7-2,1.3-3,2c-45.5,36.9-94.7,74.2-109.9,85.6c-2.9,2.2-6.8,2.6-10,1 l-40.8-19.7c-3.3-1.6-7.3-1.2-10.2,1.1l-30.6,23.9c-2.9,2.3-6.8,2.7-10.1,1.1l-33.4-15.8c-3.3-1.5-7.1-1.1-10,1l-32.5,24.7 c-2.8,2.1-6.5,2.6-9.7,1.2l-35.1-15.4c-3.2-1.4-6.9-1-9.7,1.1l-27.3,20.5c-2.5,1.9-5.8,2.5-8.8,1.5c-6.3-2.1-17.5-5.7-25.5-7.4 c-1.7-0.4-3.4-0.2-5.1,0.3c-19.6,6.4-37.8,14-53.7,22.9c-11.3,6.3-21.4,13.3-29.9,21.1c-74.2,68-47.3,144-47.3,144 C1074.1,727.5,1103.9,575.6,1123.2,534.8z"/> </g> <g> <g> <path class="st7" d="M2020.3,642.8c3.2,0,3.2-5,0-5C2017.1,637.8,2017.1,642.8,2020.3,642.8L2020.3,642.8z"/> </g> </g></g></svg>'
)
);

Expand Down
1 change: 1 addition & 0 deletions test/mock/MockPearlGaugeV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract MockPearlGaugeV2 {

///@notice see earned rewards for user
function earned(address account) public view returns (uint) {
// todo changeable
return balanceOf[account] / 1e10;
}

Expand Down

0 comments on commit 9d8b203

Please sign in to comment.