Sha256: 747513b9548d8201c0f99bea608bd0b40d213fa0284dc11cdec5072ae22471b8
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
class OpenEditionERC721 < ERC721 storage contentURI: String, maxPerAddress: UInt, totalSupply: UInt, description: String, mintStart: Timestamp, mintEnd: Timestamp sig [String, String, String, UInt, String, Timestamp, Timestamp] def constructor( name:, symbol:, contentURI:, maxPerAddress:, description:, mintStart:, mintEnd: ) super(name: name, symbol: symbol) @maxPerAddress = maxPerAddress @description = description @contentURI = contentURI @mintStart = mintStart @mintEnd = mintEnd end sig [UInt] def mint( amount: ) assert(amount > 0, 'Amount must be positive') assert(amount + @_balanceOf[msg.sender] <= @maxPerAddress, 'Exceeded mint limit') assert(block.timestamp >= @mintStart, 'Minting has not started') assert(block.timestamp < @mintEnd, 'Minting has ended') amount.times do |id| _mint(to: msg.sender, id: @totalSupply + id) end @totalSupply += amount end sig [UInt], :view, returns: String def tokenURI( id: ) assert(_exists(id: id), 'ERC721Metadata: URI query for nonexistent token') json_data = { name: "#{@name} ##{string(id)}", description: @description, image: @contentURI, }.to_json "data:application/json,#{json_data}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubysol-contracts-0.1.0 | lib/rubysol/contracts/open_edition_erc721.rb |