Skip to content

Commit

Permalink
added beanEth art
Browse files Browse the repository at this point in the history
  • Loading branch information
Brean0 committed Jul 7, 2023
1 parent 78d7045 commit 0044391
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 10 deletions.
17 changes: 17 additions & 0 deletions protocol/contracts/beanstalk/metadata/MetadataImage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ contract MetadataImage {
bean3CRVToken(),
urBeanToken(),
urBean3CRVToken(),
beanETHCP2WellToken(),
fullLeafRow(),
'</defs>'
));
Expand Down Expand Up @@ -447,6 +448,19 @@ contract MetadataImage {
);
}

function beanETHCP2WellToken() internal pure returns (string memory){
return string(abi.encodePacked(
'<g id="BEAN:ETHw">',
'<rect width="12" height="12" rx="6" fill="#46B955"/>',
'<path d="M6 12A6 6 0 1 0 6 0a6 6 0 0 0 0 12Z" fill="#50AE58"/>',
'<path d="m7.684 1.265-3.505 9.36c.003 0-3.884-6.625 3.505-9.36Z" fill="#fff"/>',
'<path d="M8.952 6.986a.063.063 0 0 1-.022.003c-.71.13-1.424.255-2.134.381-.281.052-.565.103-.846.152a.036.036 0 0 1-.026 0l2.14-5.625.004-.003c.297 1.702.59 3.394.884 5.092Zm-.187.478c-1.266.859-2.531 1.721-3.8 2.58l.781-2.054c.007.004.013 0 .023 0 .759-.132 1.514-.268 2.27-.4l.697-.126.03-.006c-.004.003 0 .006 0 .006Z" fill="#000"/>',
'</g>'
)
);
}


function useAssetTransform(string memory assetName, int256 x, int256 y) internal pure returns (string memory) {
return string(abi.encodePacked(
'<use xlink:href="#',
Expand Down Expand Up @@ -565,6 +579,9 @@ contract MetadataImage {
}
else if(token == C.UNRIPE_LP) {
tokenString = "urBean3CRV";
}
else if(token == C.BEAN_ETH_WELL) {
tokenString = "BEAN:ETHw";
} else {
revert("token not whitelisted.");
}
Expand Down
21 changes: 15 additions & 6 deletions protocol/test/Silo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { BEAN, BEANSTALK, BCM, BEAN_3_CURVE, UNRIPE_BEAN, UNRIPE_LP, THREE_CURVE,
const { takeSnapshot, revertToSnapshot } = require("./utils/snapshot");
const { time, mineUpTo, mine } = require("@nomicfoundation/hardhat-network-helpers");
const ZERO_BYTES = ethers.utils.formatBytes32String('0x0')
const { whitelistWell, deployMockWell } = require('../utils/well.js');
const fs = require('fs');

let user, user2, owner;
Expand All @@ -26,7 +27,6 @@ describe('Silo', function () {
this.season = await ethers.getContractAt('MockSeasonFacet', this.diamond.address);

await this.season.teleportSunrise(10);

this.season.deployStemsUpgrade();

this.silo = await ethers.getContractAt('MockSiloFacet', this.diamond.address);
Expand All @@ -35,8 +35,12 @@ describe('Silo', function () {
this.approval = await ethers.getContractAt('ApprovalFacet', this.diamond.address);
this.fertilizer = await ethers.getContractAt('MockFertilizerFacet', this.diamond.address)
this.unripe = await ethers.getContractAt('MockUnripeFacet', this.diamond.address)
this.whitelist = await ethers.getContractAt('WhitelistFacet', this.diamond.address)
await this.unripe.addUnripeToken(UNRIPE_BEAN, BEAN, ZERO_BYTES)
await this.unripe.addUnripeToken(UNRIPE_LP, BEAN_3_CURVE, ZERO_BYTES)
await this.unripe.addUnripeToken(UNRIPE_LP, BEAN_3_CURVE, ZERO_BYTES);
[this.well, this.wellFunction, this.pump] = await deployMockWell()
await whitelistWell(this.well.address, '10000', to6('4'))
await this.season.captureWellE(this.well.address)


this.bean = await ethers.getContractAt('Bean', BEAN);
Expand All @@ -59,6 +63,7 @@ describe('Silo', function () {

this.result = await this.silo.connect(user).deposit(this.bean.address, to6('1000'), EXTERNAL)
this.result = await this.silo.connect(user2).deposit(this.bean.address, to6('1000'), EXTERNAL)

});

beforeEach(async function () {
Expand Down Expand Up @@ -356,6 +361,7 @@ describe('Silo', function () {

it("properly gives an URI", async function () {
await this.season.farmSunrises(1000);

depositmetadata = await fs.readFileSync(__dirname + '/data/base64EncodedImageBean.txt', 'utf-8');
depositID1 = '0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab000000000000000000000002';
expect(await this.metadata.uri(depositID1)).to.eq(depositmetadata);
Expand All @@ -365,13 +371,16 @@ describe('Silo', function () {
expect(await this.metadata.uri(depositID2)).to.eq(depositmetadata);

depositmetadata = await fs.readFileSync(__dirname + '/data/base64EncodedImageUrBean.txt', 'utf-8');
depositID2 = '0x1BEA0050E63e05FBb5D8BA2f10cf5800B6224449000000000000000000000400';
expect(await this.metadata.uri(depositID2)).to.eq(depositmetadata);
depositID3 = '0x1BEA0050E63e05FBb5D8BA2f10cf5800B6224449000000000000000000000400';
expect(await this.metadata.uri(depositID3)).to.eq(depositmetadata);

depositmetadata = await fs.readFileSync(__dirname + '/data/base64EncodedImageUrBean3Crv.txt', 'utf-8');
depositID2 = '0x1BEA3CcD22F4EBd3d37d731BA31Eeca95713716D000000000000000000000684';
expect(await this.metadata.uri(depositID2)).to.eq(depositmetadata);
depositID4 = '0x1BEA3CcD22F4EBd3d37d731BA31Eeca95713716D000000000000000000000684';
expect(await this.metadata.uri(depositID4)).to.eq(depositmetadata);

depositmetadata = await fs.readFileSync(__dirname + '/data/base64EncodedImageBeanEth.txt', 'utf-8');
depositID5 = '0x9bAaB117304f7D6517048e371025dB8f89a8DbE5000000000000000000000002';
expect(await this.metadata.uri(depositID5)).to.eq(depositmetadata);

});

Expand Down
Loading

0 comments on commit 0044391

Please sign in to comment.