Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Submit erc3525 #7

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions contracts/erc3525Example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types

# Hardhat files
cache
artifacts


44 changes: 44 additions & 0 deletions contracts/erc3525Example/contracts/ERC3525GettingStarted.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/utils/Strings.sol";
import "@solvprotocol/erc-3525/ERC3525.sol";

// Uncomment this line to use console.log
// import "hardhat/console.sol";

contract ERC3525GettingStarted is ERC3525 {
using Strings for uint256;

address public owner;

constructor(address owner_) ERC3525("ERC3525GettingStarted", "ERC3525GS", 18) {
owner = owner_;
}

function mint(address to_, uint256 slot_, uint256 amount_) external {
require(msg.sender == owner, "ERC3525GettingStarted: only owner can mint");
_mint(to_, slot_, amount_);
}

function tokenURI(uint256 tokenId_) public view virtual override returns (string memory) {
return string(
abi.encodePacked(
'<svg width="600" height="600" xmlns="http://www.w3.org/2000/svg">',
' <g> <title>Layer 1</title>',
' <rect id="svg_1" height="600" width="600" y="0" x="0" stroke="#000" fill="#000000"/>',
' <text xml:space="preserve" text-anchor="start" font-family="Noto Sans JP" font-size="24" id="svg_2" y="340" x="200" stroke-width="0" stroke="#000" fill="#ffffff">TokeId: ',
tokenId_.toString(),
'</text>',
' <text xml:space="preserve" text-anchor="start" font-family="Noto Sans JP" font-size="24" id="svg_3" y="410" x="200" stroke-width="0" stroke="#000" fill="#ffffff">Balance: ',
balanceOf(tokenId_).toString(),
'</text>',
' <text xml:space="preserve" text-anchor="start" font-family="Noto Sans JP" font-size="24" id="svg_3" y="270" x="200" stroke-width="0" stroke="#000" fill="#ffffff">Slot: ',
slotOf(tokenId_).toString(),
'</text>',
' <text xml:space="preserve" text-anchor="start" font-family="Noto Sans JP" font-size="24" id="svg_4" y="160" x="150" stroke-width="0" stroke="#000" fill="#ffffff">ERC3252 GETTING STARTED</text>',
' </g> </svg>'
)
);
}
}
15 changes: 15 additions & 0 deletions contracts/erc3525Example/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
solidity: "0.8.17",
networks: {
sepolia: {
url: process.env.SEPOLIA_URL || `https://sepolia.infura.io/v3/${process.env.INFURA_KEY}`,
accounts:
process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
},
}
};

export default config;
Loading