Skip to content

Commit

Permalink
deployed again again
Browse files Browse the repository at this point in the history
  • Loading branch information
okwme committed Sep 10, 2024
1 parent c06a9d2 commit 51e4d28
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 33 deletions.
2 changes: 1 addition & 1 deletion contractData/84532-ExternalMetadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"address":"0x96E5DBb8D775d523303dC3549CC1049F0A249724","chain":{"chainId":84532,"name":"unknown"}}
{"address":"0x081EBC966C9AA09e68422fCeDCe1C054354E997f","chain":{"chainId":84532,"name":"unknown"}}
2 changes: 1 addition & 1 deletion contractData/84532-Selection.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"address":"0xFD7E4290209FC87817a105E909B3eAB0E2Aba090","chain":{"chainId":84532,"name":"unknown"}}
{"address":"0xbD37D3EcbD6f235fAC6d22Cb4b9f799Aa98f7A5F","chain":{"chainId":84532,"name":"unknown"}}
2 changes: 1 addition & 1 deletion contractData/ABI-84532-Selection.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions contracts/ExternalMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract ExternalMetadata is Ownable {
"background-position: 0 0, 0 4px, 4px -4px, -4px 0px;";

address payable public selection;
string public filename = "selection_15_35.js.gz";
string public filename = "selection_16_14.js.gz";

constructor() {}

Expand Down Expand Up @@ -84,8 +84,8 @@ contract ExternalMetadata is Ownable {
'{"name":"Selection No. ',
getName(tokenId),
'",',
'"description": "In Selection, the focus of the work is focus itself.\n\n'
"The project is a fully on-chain generated collection of selection areas, the familiar marching ants conceived by Bill Atkinson which have become such a ubiquitous part of interface culture.\n"
'"description": "In Selection, the focus of the work is focus itself.\\n\\n',
"The project is a fully on-chain generated collection of selection areas, the familiar marching ants conceived by Bill Atkinson which have become such a ubiquitous part of interface culture.\\n",
"Selection is released in partnership with Folia.",
'","image": "',
svg,
Expand Down Expand Up @@ -174,13 +174,14 @@ contract ExternalMetadata is Ownable {
bool backroundOverridden,
uint256 backgroundOverride
) = getBackgroundOverride(tokenId);
uint256 totalStyles = 4;

// 0: color
// 1: white
// 2: black
// 3: transparent
uint256 bgStyle = bgStyleRand <= 7
uint256 bgStyle = backroundOverridden
? backgroundOverride
: bgStyleRand <= 7
? 0
: (bgStyleRand <= 8 ? 1 : (bgStyleRand <= 9 ? 2 : 3));
string memory finalColor;
Expand Down
1 change: 1 addition & 0 deletions contracts/Selection.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ contract Selection is Ownable, ERC2981, ERC721 {

function changeBackground(uint256 tokenId, uint256 override_) public {
require(_isApprovedOrOwner(_msgSender(), tokenId), "Not approved");
require(override_ <= 3, "invalid override number");
backgroundOverride[tokenId] = override_;
backgroundOverriden[tokenId] = true;
emit BackgroundUpdated(tokenId, override_);
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/selection.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/selection.js.map

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions index.html

Large diffs are not rendered by default.

33 changes: 21 additions & 12 deletions src/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ const urlInfo = window.location.hash.substr(1).split("-");
let tokenId = parseInt(urlInfo[0]);
let backgroundOffset = 0;
let backgroundOverride =
window.backgroundOverride || urlInfo.length > 1
? parseInt(urlInfo[1])
: false;
typeof window.backgroundOverride !== "undefined"
? window.backgroundOverride
: urlInfo.length > 1
? parseInt(urlInfo[1])
: false;
if (backgroundOverride > 3) {
backgroundOverride = false;
}
if (!tokenId) {
tokenId = Math.floor(Math.random() * 150) + 1;
// if (!tokenId) {
// throw new Error(
// "no token id, please add to url like https://website.domain#tokenId"
// );
// }
}
console.log({ tokenId });
console.log({ tokenId }); // TODO: remove comments before mainnet

let seed = solidityKeccak256(["uint256"], [tokenId]);
if (
Expand Down Expand Up @@ -523,9 +523,17 @@ function setBg(seed) {

const totalStyles = 4;
let bgState =
((bgStyleRand <= 7 ? 0 : bgStyleRand <= 8 ? 1 : bgStyleRand <= 9 ? 2 : 3) +
backgroundOffset) %
totalStyles;
typeof backgroundOverride !== "boolean"
? backgroundOverride
: ((bgStyleRand <= 7
? 0
: bgStyleRand <= 8
? 1
: bgStyleRand <= 9
? 2
: 3) +
backgroundOffset) %
totalStyles;
let finalColor, gradAngle, dark;
if (bgState == 0) {
if (solidOverGrad) {
Expand Down Expand Up @@ -579,6 +587,7 @@ function setBg(seed) {
background-size: 8px 8px;
background-position: 0 0, 0 4px, 4px -4px, -4px 0px;`;
}
console.log({ bgState, finalColor });
document.getElementsByTagName("svg")[0].style = finalColor;
}

Expand Down

0 comments on commit 51e4d28

Please sign in to comment.