mirror of
https://github.com/sharkdp/bat
synced 2026-08-04 19:01:44 +00:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3aea51455b | |||
| f827ed338b | |||
| 73dab51ad1 | |||
| 9328007d05 | |||
| 8d173cd960 | |||
| fb0f12a221 | |||
| 9866408b72 | |||
| aaac56d895 | |||
| 516da7719f | |||
| d4df0b4405 | |||
| bfa9c3bef6 | |||
| 2904f24ea8 | |||
| 91a347bf6d | |||
| e219c8fc03 | |||
| 9eb26b702c | |||
| c933be926d | |||
| fc88040b31 | |||
| 5db3c93057 | |||
| aa442b5795 | |||
| 09711cd6f9 | |||
| b16cacc758 | |||
| 51451a9636 | |||
| fbc03da997 | |||
| 1a610dbdd2 | |||
| a30e3c9066 | |||
| 613b41e357 | |||
| d405aa98d5 | |||
| 285b1556a9 | |||
| 8321cc661c | |||
| 848ceb6f10 | |||
| 3559079de0 | |||
| b3ab843954 | |||
| 867cf63dd9 | |||
| 0b44aa6f68 | |||
| aa09a9dc04 | |||
| 7c4edacb2b | |||
| 782ede5db5 | |||
| 1537733e6b | |||
| ba0d43672b | |||
| 4384d25c79 | |||
| b6e3786529 | |||
| 6fff01397d | |||
| 0cd52e5be1 | |||
| c14dd34dca | |||
| e04fbd1992 | |||
| d89fa3ebc2 | |||
| db57454f3f | |||
| 8f93844427 | |||
| 52f84b063c | |||
| 2e7f2b6c07 | |||
| 35347c2310 | |||
| b489fc75c9 | |||
| fc24cb2a77 | |||
| 2540311cdf | |||
| 3880888286 | |||
| 5a806c2149 | |||
| 8a926d511a | |||
| 8885285b10 | |||
| d1f0181947 | |||
| b147443c32 |
@@ -9,11 +9,6 @@ assignees: ''
|
||||
|
||||
<!-- Hey there, thank you for creating an issue! -->
|
||||
|
||||
**What version of `bat` are you using?**
|
||||
|
||||
<!-- Output of `bat --version` -->
|
||||
|
||||
|
||||
**Describe the bug you encountered:**
|
||||
|
||||
...
|
||||
@@ -29,19 +24,24 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Environment**
|
||||
**bat version and environment**
|
||||
|
||||
<!--
|
||||
In order to reproduce your issue, please add some information about the environment
|
||||
in which you're running bat.
|
||||
in which you're running bat. To do this, run the full `bat` command that demonstrates
|
||||
the bug, and attach the `--diagnostic` option:
|
||||
|
||||
Linux and MacOS:
|
||||
Please run the script at
|
||||
bat [other options and arguments…] --diagnostic
|
||||
|
||||
Finally, paste the Markdown output here. Please make sure that it does not reveal any
|
||||
personal information.
|
||||
|
||||
|
||||
If you are running bat 0.17.1 or older (where --diagnostic is not available), please
|
||||
run the script at
|
||||
|
||||
https://github.com/sharkdp/bat/blob/master/diagnostics/info.sh
|
||||
|
||||
(click "Raw" to get the actual source code) and paste the Markdown output here.
|
||||
|
||||
Windows:
|
||||
Please add your Windows Version (e.g. "Windows 10 1908")
|
||||
(click "Raw" to get the actual source code) and paste the Markdown output here. If you
|
||||
are on Windows, please let us know your bat version and your Windows version.
|
||||
-->
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: cargo
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
ignore:
|
||||
- dependency-name: git2
|
||||
versions:
|
||||
- 0.13.17
|
||||
- package-ecosystem: gitsubmodule
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "04:00"
|
||||
timezone: Europe/Berlin
|
||||
@@ -1,7 +1,7 @@
|
||||
name: CICD
|
||||
|
||||
env:
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.42.0"
|
||||
MIN_SUPPORTED_RUST_VERSION: "1.45.0"
|
||||
CICD_INTERMEDIATES_DIR: "_cicd-intermediates"
|
||||
|
||||
on:
|
||||
@@ -31,9 +31,7 @@ jobs:
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
# clippy::match_bool is allowed by default from Rust 1.45.0, see
|
||||
# https://github.com/rust-lang/rust-clippy/commit/e1d13c34b0beaea9a5fbf13687672ef85e779d9f
|
||||
args: --all-targets --all-features -- --allow clippy::match_bool
|
||||
args: --all-targets --all-features
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
@@ -81,6 +79,13 @@ jobs:
|
||||
run: bat --list-languages
|
||||
- name: List of themes
|
||||
run: bat --list-themes
|
||||
- name: Check documentation
|
||||
env:
|
||||
RUSTDOCFLAGS: -D warnings
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: doc
|
||||
args: --no-deps --document-private-items --all-features
|
||||
|
||||
build:
|
||||
name: ${{ matrix.job.os }} (${{ matrix.job.target }})
|
||||
|
||||
+9
-7
@@ -61,9 +61,6 @@
|
||||
[submodule "assets/syntaxes/Puppet"]
|
||||
path = assets/syntaxes/02_Extra/Puppet
|
||||
url = https://github.com/russCloak/SublimePuppet
|
||||
[submodule "assets/syntaxes/CSV"]
|
||||
path = assets/syntaxes/02_Extra/CSV
|
||||
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
|
||||
[submodule "assets/themes/onehalf"]
|
||||
path = assets/themes/onehalf
|
||||
url = https://github.com/sonph/onehalf
|
||||
@@ -97,10 +94,6 @@
|
||||
[submodule "assets/syntaxes/Assembly (ARM)"]
|
||||
path = assets/syntaxes/02_Extra/Assembly (ARM)
|
||||
url = https://github.com/tvi/Sublime-ARM-Assembly
|
||||
[submodule "assets/syntaxes/syslog-syntax"]
|
||||
path = assets/syntaxes/02_Extra/Syslog
|
||||
url = https://github.com/caos21/syslog-syntax.git
|
||||
branch = master
|
||||
[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
|
||||
path = assets/syntaxes/02_Extra/Protobuf
|
||||
url = https://github.com/VcamX/protobuf-syntax-highlighting.git
|
||||
@@ -216,3 +209,12 @@
|
||||
[submodule "assets/syntaxes/02_Extra/gnuplot"]
|
||||
path = assets/syntaxes/02_Extra/gnuplot
|
||||
url = https://github.com/hesstobi/sublime_gnuplot
|
||||
[submodule "assets/syntaxes/02_Extra/SystemVerilog"]
|
||||
path = assets/syntaxes/02_Extra/SystemVerilog
|
||||
url = https://github.com/TheClams/SystemVerilog.git
|
||||
[submodule "assets/themes/visual-studio-dark-plus"]
|
||||
path = assets/themes/visual-studio-dark-plus
|
||||
url = https://github.com/vidann1/visual-studio-dark-plus.git
|
||||
[submodule "assets/syntaxes/02_Extra/SublimeEthereum"]
|
||||
path = assets/syntaxes/02_Extra/SublimeEthereum
|
||||
url = https://github.com/davidhq/SublimeEthereum.git
|
||||
@@ -1,5 +1,51 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
## Bugfixes
|
||||
|
||||
|
||||
## Other
|
||||
|
||||
|
||||
## Syntaxes
|
||||
|
||||
|
||||
## New themes
|
||||
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
|
||||
|
||||
|
||||
# v0.18.1
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Mouse support and screen clearing broken for `less` versions with minor version number (581.2), see #1629 and #1639 (@aswild)
|
||||
|
||||
## Other
|
||||
|
||||
- `Input::ordinary_file` and `Input::with_name` now accept `Path` rather than `OsStr` see #1571 (@matklad)
|
||||
- The `LESS` environment variable is now included in `bat --diagnostic`, see #1589 (@Enselic)
|
||||
- Increased min. required Rust version to 1.45
|
||||
|
||||
## Syntaxes
|
||||
|
||||
- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
|
||||
- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
|
||||
- Added SystemVerilog file syntax, see #1580 (@SeanMcLoughlin)
|
||||
- Added Solidity and Vyper syntax, see #1602 (@Ersikan)
|
||||
|
||||
## New themes
|
||||
|
||||
- Dark+ VS Code theme, see #1588 and #1598 (@PatriotRossii)
|
||||
|
||||
|
||||
|
||||
# v0.18.0
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
Generated
+117
-135
@@ -2,15 +2,15 @@
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "0.2.3"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.15"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -81,7 +81,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bat"
|
||||
version = "0.18.0"
|
||||
version = "0.18.1"
|
||||
dependencies = [
|
||||
"ansi_colours",
|
||||
"ansi_term 0.12.1",
|
||||
@@ -115,11 +115,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bincode"
|
||||
version = "1.3.1"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f30d3a39baa26f9651f17b375061f3233dde33424a8b72b0dbe93a68a0bc896d"
|
||||
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -146,9 +145,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d"
|
||||
checksum = "90682c8d613ad3373e66de8c6411e0ae2ab2571e879d2efbf73558cc66f21279"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"memchr",
|
||||
@@ -157,25 +156,26 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "bugreport"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "116762017f173ea5d8103e75533f6bdb62cb6f2257c9c95672beb085a70daed8"
|
||||
checksum = "a0e97e538864a7c95d33accbf64c8d354018ba3b6e032502fd0fe7259cf1aa3d"
|
||||
dependencies = [
|
||||
"snailquote",
|
||||
"git-version",
|
||||
"shell-escape",
|
||||
"sys-info",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.4.2"
|
||||
version = "1.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.66"
|
||||
version = "1.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
||||
checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
]
|
||||
@@ -226,9 +226,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
version = "0.14.0"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa"
|
||||
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static",
|
||||
@@ -292,9 +292,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.7"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
|
||||
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
|
||||
|
||||
[[package]]
|
||||
name = "encode_unicode"
|
||||
@@ -414,9 +414,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
|
||||
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"percent-encoding",
|
||||
@@ -434,10 +434,32 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.15"
|
||||
name = "git-version"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44f267c9da8a4de3c615b59e23606c75f164f84896e97f4dd6c15a4294de4359"
|
||||
checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2"
|
||||
dependencies = [
|
||||
"git-version-macro",
|
||||
"proc-macro-hack",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git-version-macro"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657"
|
||||
dependencies = [
|
||||
"proc-macro-hack",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.13.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17929de7239dea9f68aa14f94b2ab4974e7b24c1314275ffcc12a7758172fa18"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
@@ -482,9 +504,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.2.1"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094"
|
||||
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
|
||||
dependencies = [
|
||||
"matches",
|
||||
"unicode-bidi",
|
||||
@@ -493,9 +515,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.6.1"
|
||||
version = "1.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
||||
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@@ -518,9 +540,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.21"
|
||||
version = "0.1.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2"
|
||||
checksum = "972f5ae5d1cb9c6ae417789196c803205313edde988685da5e3aae0827b9e7fd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -539,15 +561,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.86"
|
||||
version = "0.2.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
|
||||
checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.12.18+1.1.0"
|
||||
version = "0.12.20+1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
|
||||
checksum = "1e2f09917e00b9ad194ae72072bb5ada2cca16d8171a43e91ddba2afbb02664b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -557,9 +579,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.2"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "602113192b08db8f38796c4e85c39e960c145965140e918018bcde1952429655"
|
||||
checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -584,9 +606,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.2"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
|
||||
checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
@@ -608,15 +630,15 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.4"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d"
|
||||
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
|
||||
dependencies = [
|
||||
"adler",
|
||||
"autocfg",
|
||||
@@ -624,9 +646,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.19.1"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
|
||||
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
@@ -659,12 +681,6 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
|
||||
|
||||
[[package]]
|
||||
name = "onig"
|
||||
version = "6.1.1"
|
||||
@@ -714,9 +730,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "path_abs"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb6b8e6dede0bf94e9300e669f335ba92d5fc9fc8be7f4b1ca8a05206489388c"
|
||||
checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3"
|
||||
dependencies = [
|
||||
"std_prelude",
|
||||
]
|
||||
@@ -764,9 +780,9 @@ checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "1.0.7"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eeb433456c1a57cc93554dea3ce40b4c19c4057e41c55d4a0f3d84ea71c325aa"
|
||||
checksum = "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df"
|
||||
dependencies = [
|
||||
"difference",
|
||||
"float-cmp",
|
||||
@@ -792,10 +808,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.24"
|
||||
name = "proc-macro-hack"
|
||||
version = "0.5.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
|
||||
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
@@ -851,9 +873,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.5"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
|
||||
checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
@@ -870,14 +892,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.4.3"
|
||||
version = "1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
"thread_local",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -891,9 +912,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.22"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
@@ -951,18 +972,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.123"
|
||||
version = "1.0.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae"
|
||||
checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.123"
|
||||
version = "1.0.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31"
|
||||
checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -971,9 +992,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.62"
|
||||
version = "1.0.64"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486"
|
||||
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -1014,6 +1035,12 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-escape"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
|
||||
|
||||
[[package]]
|
||||
name = "shell-words"
|
||||
version = "1.0.0"
|
||||
@@ -1026,16 +1053,6 @@ version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "snailquote"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f34b729d802f52194598858ac852c3fb3b33f6e026cd03195072ccb7bf3fc810"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"unicode_categories",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "std_prelude"
|
||||
version = "0.2.12"
|
||||
@@ -1050,9 +1067,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.60"
|
||||
version = "1.0.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081"
|
||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1084,9 +1101,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sys-info"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5cfbd84f86389198ade41b439f72a5b1b3a8ba728e61cd589e1720d0df44c39"
|
||||
checksum = "33fcecee49339531cf6bd84ecf3ed94f9c8ef4a7e700f2a1cac9cc1ca485383a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1136,40 +1153,11 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023"
|
||||
checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
@@ -1194,9 +1182,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.4"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0"
|
||||
dependencies = [
|
||||
"matches",
|
||||
]
|
||||
@@ -1218,21 +1206,15 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "unicode_categories"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.2.0"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
|
||||
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
@@ -1242,9 +1224,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb"
|
||||
checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
@@ -1254,9 +1236,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
@@ -1269,9 +1251,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.1"
|
||||
version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi",
|
||||
|
||||
+4
-4
@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
|
||||
license = "MIT/Apache-2.0"
|
||||
name = "bat"
|
||||
repository = "https://github.com/sharkdp/bat"
|
||||
version = "0.18.0"
|
||||
version = "0.18.1"
|
||||
exclude = ["assets/syntaxes/*", "assets/themes/*"]
|
||||
build = "build.rs"
|
||||
edition = '2018'
|
||||
@@ -36,7 +36,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
||||
atty = { version = "0.2.14", optional = true }
|
||||
ansi_term = "^0.12.1"
|
||||
ansi_colours = "^1.0"
|
||||
console = "0.14.0"
|
||||
console = "0.14.1"
|
||||
lazy_static = { version = "1.4", optional = true }
|
||||
wild = { version = "2.0", optional = true }
|
||||
content_inspector = "0.2.4"
|
||||
@@ -49,7 +49,7 @@ serde_yaml = "0.8"
|
||||
semver = "0.11"
|
||||
path_abs = { version = "0.5", default-features = false }
|
||||
clircle = "0.3"
|
||||
bugreport = "0.3"
|
||||
bugreport = "0.4"
|
||||
dirs-next = { version = "2.0.0", optional = true }
|
||||
|
||||
[dependencies.git2]
|
||||
@@ -80,7 +80,7 @@ wait-timeout = "0.2.0"
|
||||
tempfile = "3.2.0"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
nix = "0.19.1"
|
||||
nix = "0.20.0"
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "2.33", optional = true }
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 bat-developers (https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 bat-developers (https://github.com/sharkdp/bat).
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -222,7 +222,7 @@ the most recent release of `bat`, download the latest `.deb` package from the
|
||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -363,7 +363,7 @@ binaries are also available: look for archives with `musl` in the file name.
|
||||
|
||||
### From source
|
||||
|
||||
If you want to build `bat` from source, you need Rust 1.42 or
|
||||
If you want to build `bat` from source, you need Rust 1.45 or
|
||||
higher. You can then use `cargo` to build everything:
|
||||
|
||||
```bash
|
||||
@@ -727,7 +727,7 @@ There are a lot of alternatives, if you are looking for similar programs. See
|
||||
[this document](doc/alternatives.md) for a comparison.
|
||||
|
||||
## License
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
||||
|
||||
|
||||
+19
-1
@@ -7,7 +7,7 @@ index 9c2aa3e..180cbbf 100644
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
- <string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
+ <string>meta.mapping.key.json string.quoted.double.json</string>
|
||||
+ <string>meta.mapping.key.json string.quoted.double.json, punctuation.separator.sequence.csv</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
@@ -16,3 +16,21 @@ index 9c2aa3e..180cbbf 100644
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
@@ -1027,7 +1027,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid</string>
|
||||
+ <string>invalid, markup.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
@@ -1042,7 +1042,7 @@
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
- <string>invalid.deprecated</string>
|
||||
+ <string>invalid.deprecated, markup.warning</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Vendored
-1
Submodule assets/syntaxes/02_Extra/CSV deleted from 4786d037a7
+71
-39
@@ -1,46 +1,78 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Advanced CSV
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Comma Separated Values
|
||||
file_extensions:
|
||||
- csv
|
||||
- tsv
|
||||
scope: text.advanced_csv
|
||||
scope: text.csv
|
||||
variables:
|
||||
field_separator: (?:[,;\t])
|
||||
record_separator: (?:$\n?)
|
||||
contexts:
|
||||
prototype:
|
||||
- match: (?={{record_separator}})
|
||||
pop: true
|
||||
fields:
|
||||
- match: ''
|
||||
push:
|
||||
- field_or_record_separator
|
||||
- field4
|
||||
- field_or_record_separator
|
||||
- field3
|
||||
- field_or_record_separator
|
||||
- field2
|
||||
- field_or_record_separator
|
||||
- field1
|
||||
main:
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.quoted.advanced_csv
|
||||
- match: (\")
|
||||
captures:
|
||||
1: string.quoted.double.advanced_csv
|
||||
pop: true
|
||||
- include: main
|
||||
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
2: constant.numeric.formula.advanced_csv
|
||||
4: constant.numeric.formula.advanced_csv
|
||||
6: constant.numeric.formula.advanced_csv
|
||||
8: constant.numeric.formula.advanced_csv
|
||||
9: keyword.operator.advanced_csv
|
||||
10: keyword.operator.advanced_csv
|
||||
push:
|
||||
- meta_scope: meta.range.advanced_csv
|
||||
- match: (?=(\")|$)
|
||||
pop: true
|
||||
- include: scope:source.python
|
||||
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
|
||||
scope: meta.number.advanced_csv
|
||||
captures:
|
||||
1: constant.numeric.advanced_csv
|
||||
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
|
||||
scope: meta.nonnumber.advanced_csv
|
||||
captures:
|
||||
1: storage.type.advanced_csv
|
||||
- match: (\,)
|
||||
scope: meta.delimiter.advanced_csv
|
||||
captures:
|
||||
1: keyword.operator.advanced_csv
|
||||
- meta_include_prototype: false
|
||||
- match: '^'
|
||||
set: fields
|
||||
|
||||
field_or_record_separator:
|
||||
- meta_include_prototype: false
|
||||
- match: '{{record_separator}}'
|
||||
scope: punctuation.terminator.record.csv
|
||||
pop: true
|
||||
- match: '{{field_separator}}'
|
||||
scope: punctuation.separator.sequence.csv
|
||||
pop: true
|
||||
|
||||
field_contents:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.csv
|
||||
push: double_quoted_string
|
||||
|
||||
- match: (?={{field_separator}}|{{record_separator}})
|
||||
pop: true
|
||||
|
||||
double_quoted_string:
|
||||
- meta_include_prototype: false
|
||||
- meta_scope: string.quoted.double.csv
|
||||
- match: '""'
|
||||
scope: constant.character.escape.csv
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.csv
|
||||
pop: true
|
||||
|
||||
field1:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-1.csv support.type
|
||||
- include: field_contents
|
||||
field2:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-2.csv support.function
|
||||
- include: field_contents
|
||||
field3:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||
- include: field_contents
|
||||
field4:
|
||||
- match: ''
|
||||
set:
|
||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||
- include: field_contents
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Crystal updated: 5e032ff5f5...eb63666f35
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/FSharp updated: c18616d6bd...9e4645c608
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Julia updated: e2b1cb549d...cc13e7d4ef
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/LESS updated: 44632e19af...a2eae0453e
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/Lean updated: 49d185361a...29a03a8aba
Vendored
+1
-1
Submodule assets/syntaxes/02_Extra/SCSS_Sass updated: 4868322030...63819a1ab6
+1
Submodule assets/syntaxes/02_Extra/SublimeEthereum added at b60e0a3e00
Vendored
-1
Submodule assets/syntaxes/02_Extra/Syslog deleted from 7628d4e0b8
+1
Submodule assets/syntaxes/02_Extra/SystemVerilog added at 7eca705e87
+116
@@ -0,0 +1,116 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# See http://www.sublimetext.com/docs/3/syntax.html
|
||||
file_extensions:
|
||||
- log
|
||||
scope: text.log
|
||||
variables:
|
||||
ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
|
||||
contexts:
|
||||
main:
|
||||
- match: (\w+)(=)
|
||||
captures:
|
||||
1: variable.parameter.log
|
||||
2: keyword.operator.assignment.log
|
||||
- match: (')([^']*)(')
|
||||
scope: string.quoted.single.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- match: (")([^"]*)(")
|
||||
scope: string.quoted.double.log
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.log
|
||||
3: punctuation.definition.string.end.log
|
||||
- include: dates
|
||||
- include: ip_addresses
|
||||
- include: numbers
|
||||
- match: \b(?i:fail(?:ure|ed)?|error|exception)\b
|
||||
scope: markup.error.log
|
||||
- match: \b(?i:warn(?:ing)?)\b
|
||||
scope: markup.warning.log
|
||||
#- include: scope:text.html.markdown#autolink-inet
|
||||
- match: \b\w+:/{2,3}
|
||||
scope: markup.underline.link.scheme.log
|
||||
push: url-host
|
||||
dates:
|
||||
- match: \b\d{4}-\d{2}-\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b\d{4}/\d{2}/\d{2}\b
|
||||
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
- match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
|
||||
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
ip_addresses:
|
||||
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v4.log meta.number.integer.decimal.log
|
||||
- match: \d+
|
||||
scope: constant.numeric.value.log
|
||||
- match: \.
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
- match: (?=(?:\h{0,4}:){2,6}\h{1,4}\b)
|
||||
push:
|
||||
- meta_scope: meta.ipaddress.v6.log meta.number.integer.hexadecimal.log
|
||||
- match: \h{1,4}
|
||||
scope: constant.numeric.value.log
|
||||
- match: ':'
|
||||
scope: punctuation.separator.sequence.log
|
||||
- match: ''
|
||||
pop: true
|
||||
numbers:
|
||||
- match: \b(0x)(\h+)(?:(\.)(\h+))?\b
|
||||
scope: meta.number.float.hexadecimal.log
|
||||
captures:
|
||||
1: constant.numeric.base.log
|
||||
2: constant.numeric.value.log
|
||||
3: constant.numeric.value.log punctuation.separator.decimal.log
|
||||
4: constant.numeric.value.log
|
||||
- match: \b\d+(\.)\d+\b
|
||||
scope: meta.number.float.log constant.numeric.value.log
|
||||
captures:
|
||||
1: punctuation.separator.decimal.log
|
||||
- match: \b\d+\b
|
||||
scope: meta.number.integer.log constant.numeric.value.log
|
||||
url-host:
|
||||
- meta_content_scope: markup.underline.link.host.log
|
||||
- match: \[
|
||||
scope: punctuation.section.brackets.begin.log
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.brackets.end.log
|
||||
pop: true
|
||||
- include: ip_addresses
|
||||
- match: '[^:/\s]+'
|
||||
- match: ''
|
||||
set: url-after-host
|
||||
url-after-host:
|
||||
- match: (:)(\d+)
|
||||
scope: markup.underline.link.port.log
|
||||
captures:
|
||||
1: punctuation.separator.mapping.port.log
|
||||
2: constant.numeric.value.log
|
||||
#- include: scope:text.html.markdown#url-escaped-chars
|
||||
- match: (%)\h{2}
|
||||
scope: markup.underline.link.path.log constant.character.escape.url.log
|
||||
captures:
|
||||
1: punctuation.definition.escape.log
|
||||
# After a valid domain, zero or more non-space non-< characters may follow
|
||||
- match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link
|
||||
pop: true
|
||||
- match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis
|
||||
push:
|
||||
- meta_scope: markup.underline.link.path.log
|
||||
- match: (?=[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: \)
|
||||
pop: true
|
||||
- match: (?=\)[?!.,:*_~]*[\s<])
|
||||
pop: true
|
||||
- match: '[^?!.,:*_~\s<&()%]+|\S'
|
||||
scope: markup.underline.link.path.log
|
||||
- match: ''
|
||||
pop: true
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename,Surname,House No.,Street,City,Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John,Doe,87,Logon Road,Citiville,TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane,Doe,22,"""Fun"" Street","The City, County",FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred,Bloggs,"19","Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines",Citee,P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
+60
@@ -0,0 +1,60 @@
|
||||
# SYNTAX TEST "CSV.sublime-syntax"
|
||||
Forename Surname House No. Street City Postcode
|
||||
#^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
John Doe 87 Logon Road Citiville TU43 6GH
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^ meta.field-4
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Jane Doe 22 """Fun"" Street" "The City County" FA90 1XA
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^ meta.field-3
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
# ^^ constant.character.escape
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.begin
|
||||
# ^^^^^^^^^^^^^^^^^ meta.field-1 string.quoted.double
|
||||
# ^ meta.field-1 string.quoted.double punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
Fred Bloggs "19" "Street
|
||||
#^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^ meta.field-2
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^ meta.field-3 string.quoted.double
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^ meta.field-4 punctuation.definition.string.begin
|
||||
# ^^^^^^^^ meta.field-4 string.quoted.double
|
||||
Spanning Multiple ""
|
||||
#^^^^^^^^^^^^^^^^^^^^ meta.field-4 string.quoted.double
|
||||
# ^^ constant.character.escape
|
||||
Lines" Citee P0stc0d3
|
||||
#^^^^^ meta.field-4 string.quoted.double
|
||||
# ^ meta.field-4 punctuation.definition.string.end
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^ meta.field-1
|
||||
# ^ punctuation.separator.sequence
|
||||
# ^^^^^^^^ meta.field-2
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 15.
|
+63
@@ -0,0 +1,63 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: syslog
|
||||
file_extensions:
|
||||
- syslog
|
||||
scope: text.log.syslog
|
||||
contexts:
|
||||
main:
|
||||
- match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
|
||||
scope: meta.datetime.syslog constant.numeric.syslog
|
||||
captures:
|
||||
1: meta.date.syslog
|
||||
2: meta.time.syslog
|
||||
push: loghost
|
||||
- match: ^
|
||||
push: text
|
||||
loghost:
|
||||
- match: '[\w-]+'
|
||||
scope: entity.other.attribute-name.loghost.syslog
|
||||
set: process
|
||||
process:
|
||||
- match: ([\w-]+)(?:(\[)(\d+)(\]))?(:)
|
||||
captures:
|
||||
1: support.function.process.syslog
|
||||
2: punctuation.separator.pid.begin.syslog
|
||||
3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
|
||||
4: punctuation.separator.pid.end.syslog
|
||||
5: punctuation.separator.mapping.syslog
|
||||
set: structured-data
|
||||
structured-data:
|
||||
- match: '\['
|
||||
scope: punctuation.section.mapping.begin.syslog
|
||||
push:
|
||||
- match: \]
|
||||
scope: punctuation.section.mapping.end.syslog
|
||||
pop: true
|
||||
- match: \w+
|
||||
scope: variable.parameter.syslog
|
||||
- match: =
|
||||
scope: keyword.operator.assignment.syslog
|
||||
push:
|
||||
- match: '[^\s\]]+'
|
||||
scope: constant.other.syslog
|
||||
pop: true
|
||||
- match: (?=\])
|
||||
pop: true
|
||||
- match: (?=\S)
|
||||
set: text
|
||||
text:
|
||||
- match: $
|
||||
pop: true
|
||||
- match: '<\w+>'
|
||||
scope: constant.language.syslog
|
||||
- match: \b(CMD)\b\s+(\()
|
||||
captures:
|
||||
1: entity.name.label.syslog
|
||||
2: punctuation.section.block.begin.syslog
|
||||
embed: scope:source.shell.bash
|
||||
escape: \)$
|
||||
escape_captures:
|
||||
0: punctuation.section.block.end.syslog
|
||||
- include: scope:text.log
|
||||
Vendored
BIN
Binary file not shown.
+1
Submodule assets/themes/visual-studio-dark-plus added at 01ee1e8e0d
Vendored
+1
-1
Submodule assets/themes/zenburn updated: 7f6fb86e0d...702023d80d
+2
-2
@@ -191,7 +191,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||
次の方法でインストールします:
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -630,7 +630,7 @@ cargo install --locked --force
|
||||
比較については [このドキュメント](alternatives.md) を参照してください。
|
||||
|
||||
## ライセンス
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` は MIT License 及び Apache License 2.0 の両方の条件の下で配布されています。
|
||||
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ apt install bat
|
||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # adapt version number and architecture
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # adapt version number and architecture
|
||||
```
|
||||
|
||||
### On Alpine Linux
|
||||
@@ -553,7 +553,7 @@ cargo install --locked --force
|
||||
비슷한 프로그램들을 찾고 있다면, 많은 대안들이 있습니다. 비교는 [이 문서]((doc/alternatives.md))를 참조해주세요.
|
||||
|
||||
## 라이센스
|
||||
Copyright (c) 2018-2020 [bat-developers](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat`는 MIT 라이센스 및 Apache 라이센스 2.0의 조건에 따라 배포됩니다.
|
||||
|
||||
|
||||
+3
-3
@@ -185,7 +185,7 @@ ln -s /usr/bin/batcat ~/.local/bin/bat
|
||||
[release page](https://github.com/sharkdp/bat/releases) и установить так:
|
||||
|
||||
```bash
|
||||
sudo dpkg -i bat_0.18.0_amd64.deb # измените архитектуру и версию
|
||||
sudo dpkg -i bat_0.18.1_amd64.deb # измените архитектуру и версию
|
||||
```
|
||||
|
||||
### Alpine Linux
|
||||
@@ -341,7 +341,7 @@ ansible-galaxy install aeimer.install_bat
|
||||
|
||||
### Из исходников
|
||||
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.42 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
Если вы желаете установить `bat` из исходников, вам понадобится Rust 1.45 или выше. После этого используйте `cargo`, чтобы все скомпилировать:
|
||||
|
||||
```bash
|
||||
cargo install --locked bat
|
||||
@@ -587,7 +587,7 @@ cargo install --locked --force
|
||||
Есть очень много альтернатив `bat`. Смотрите [этот документ](doc/alternatives.md) для сравнения.
|
||||
|
||||
## Лицензия
|
||||
Copyright (c) 2018-2020 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
Copyright (c) 2018-2021 [Разработчики bat](https://github.com/sharkdp/bat).
|
||||
|
||||
`bat` распостраняется под лицензями MIT License и Apache License 2.0 (на выбор пользователя).
|
||||
|
||||
|
||||
+5
-4
@@ -327,7 +327,7 @@ mod tests {
|
||||
writeln!(temp_file, "{}", first_line).unwrap();
|
||||
}
|
||||
|
||||
let input = Input::ordinary_file(file_path.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
@@ -341,7 +341,7 @@ mod tests {
|
||||
fn syntax_for_file_with_content_os(&self, file_name: &OsStr, first_line: &str) -> String {
|
||||
let file_path = self.temp_dir.path().join(file_name);
|
||||
let input = Input::from_reader(Box::new(BufReader::new(first_line.as_bytes())))
|
||||
.with_name(Some(file_path.as_os_str()));
|
||||
.with_name(Some(&file_path));
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
@@ -366,7 +366,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn syntax_for_stdin_with_content(&self, file_name: &str, content: &[u8]) -> String {
|
||||
let input = Input::stdin().with_name(Some(OsStr::new(file_name)));
|
||||
let input = Input::stdin().with_name(Some(file_name));
|
||||
let mut opened_input = input.open(content, None).unwrap();
|
||||
|
||||
self.assets
|
||||
@@ -450,6 +450,7 @@ mod tests {
|
||||
assert_eq!(test.syntax_for_file("test.sass"), "Sass");
|
||||
assert_eq!(test.syntax_for_file("test.js"), "JavaScript (Babel)");
|
||||
assert_eq!(test.syntax_for_file("test.fs"), "F#");
|
||||
assert_eq!(test.syntax_for_file("test.v"), "Verilog");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -521,7 +522,7 @@ mod tests {
|
||||
.expect("creation of directory succeeds");
|
||||
symlink(&file_path, &file_path_symlink).expect("creation of symbolic link succeeds");
|
||||
|
||||
let input = Input::ordinary_file(file_path_symlink.as_os_str());
|
||||
let input = Input::ordinary_file(&file_path_symlink);
|
||||
let dummy_stdin: &[u8] = &[];
|
||||
let mut opened_input = input.open(dummy_stdin, None).unwrap();
|
||||
|
||||
|
||||
+10
-7
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
use std::str::FromStr;
|
||||
|
||||
use atty::{self, Stream};
|
||||
@@ -248,16 +248,19 @@ impl App {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let filenames: Option<Vec<&str>> = self
|
||||
let filenames: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of("file-name")
|
||||
.map(|values| values.collect());
|
||||
.values_of_os("file-name")
|
||||
.map(|values| values.map(Path::new).collect());
|
||||
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||
let mut filenames_or_none: Box<dyn Iterator<Item = Option<&Path>>> = match filenames {
|
||||
Some(filenames) => Box::new(filenames.into_iter().map(Some)),
|
||||
None => Box::new(std::iter::repeat(None)),
|
||||
};
|
||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||
let files: Option<Vec<&Path>> = self
|
||||
.matches
|
||||
.values_of_os("FILE")
|
||||
.map(|vs| vs.map(Path::new).collect());
|
||||
|
||||
if files.is_none() {
|
||||
return Ok(vec![new_stdin_input(
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use bat::input::Input;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn new_file_input<'a>(file: &'a OsStr, name: Option<&'a OsStr>) -> Input<'a> {
|
||||
pub fn new_file_input<'a>(file: &'a Path, name: Option<&'a Path>) -> Input<'a> {
|
||||
named(Input::ordinary_file(file), name.or(Some(file)))
|
||||
}
|
||||
|
||||
pub fn new_stdin_input(name: Option<&OsStr>) -> Input {
|
||||
pub fn new_stdin_input(name: Option<&Path>) -> Input {
|
||||
named(Input::stdin(), name)
|
||||
}
|
||||
|
||||
fn named<'a>(input: Input<'a>, name: Option<&OsStr>) -> Input<'a> {
|
||||
fn named<'a>(input: Input<'a>, name: Option<&Path>) -> Input<'a> {
|
||||
if let Some(provided_name) = name {
|
||||
let mut input = input.with_name(Some(provided_name));
|
||||
input.description_mut().set_kind(Some("File".to_owned()));
|
||||
|
||||
+2
-2
@@ -9,7 +9,6 @@ mod directories;
|
||||
mod input;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::path::Path;
|
||||
@@ -239,6 +238,7 @@ fn run() -> Result<bool> {
|
||||
.info(EnvironmentVariables::list(&[
|
||||
"SHELL",
|
||||
"PAGER",
|
||||
"LESS",
|
||||
"BAT_PAGER",
|
||||
"BAT_CACHE_PATH",
|
||||
"BAT_CONFIG_PATH",
|
||||
@@ -269,7 +269,7 @@ fn run() -> Result<bool> {
|
||||
run_cache_subcommand(cache_matches)?;
|
||||
Ok(true)
|
||||
} else {
|
||||
let inputs = vec![Input::ordinary_file(OsStr::new("cache"))];
|
||||
let inputs = vec![Input::ordinary_file("cache")];
|
||||
let config = app.config(&inputs)?;
|
||||
|
||||
run_controller(inputs, &config)
|
||||
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
#![cfg(feature = "git")]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -17,7 +16,7 @@ pub enum LineChange {
|
||||
|
||||
pub type LineChanges = HashMap<u32, LineChange>;
|
||||
|
||||
pub fn get_git_diff(filename: &OsStr) -> Option<LineChanges> {
|
||||
pub fn get_git_diff(filename: &Path) -> Option<LineChanges> {
|
||||
let repo = Repository::discover(&filename).ok()?;
|
||||
|
||||
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||
|
||||
+15
-7
@@ -1,7 +1,7 @@
|
||||
use std::convert::TryFrom;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::File;
|
||||
use std::io::{self, BufRead, BufReader, Read};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use clircle::{Clircle, Identifier};
|
||||
use content_inspector::{self, ContentType};
|
||||
@@ -69,7 +69,7 @@ impl InputDescription {
|
||||
}
|
||||
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
}
|
||||
@@ -86,7 +86,7 @@ impl<'a> InputKind<'a> {
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub(crate) struct InputMetadata {
|
||||
pub(crate) user_provided_name: Option<OsString>,
|
||||
pub(crate) user_provided_name: Option<PathBuf>,
|
||||
}
|
||||
|
||||
pub struct Input<'a> {
|
||||
@@ -96,7 +96,7 @@ pub struct Input<'a> {
|
||||
}
|
||||
|
||||
pub(crate) enum OpenedInputKind {
|
||||
OrdinaryFile(OsString),
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader,
|
||||
}
|
||||
@@ -109,8 +109,12 @@ pub(crate) struct OpenedInput<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Input<'a> {
|
||||
pub fn ordinary_file(path: &OsStr) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_os_string());
|
||||
pub fn ordinary_file(path: impl AsRef<Path>) -> Self {
|
||||
Self::_ordinary_file(path.as_ref())
|
||||
}
|
||||
|
||||
fn _ordinary_file(path: &Path) -> Self {
|
||||
let kind = InputKind::OrdinaryFile(path.to_path_buf());
|
||||
Input {
|
||||
description: kind.description(),
|
||||
metadata: InputMetadata::default(),
|
||||
@@ -140,7 +144,11 @@ impl<'a> Input<'a> {
|
||||
matches!(self.kind, InputKind::StdIn)
|
||||
}
|
||||
|
||||
pub fn with_name(mut self, provided_name: Option<&OsStr>) -> Self {
|
||||
pub fn with_name(self, provided_name: Option<impl AsRef<Path>>) -> Self {
|
||||
self._with_name(provided_name.as_ref().map(|it| it.as_ref()))
|
||||
}
|
||||
|
||||
fn _with_name(mut self, provided_name: Option<&Path>) -> Self {
|
||||
if let Some(name) = provided_name {
|
||||
self.description.name = name.to_string_lossy().to_string()
|
||||
}
|
||||
|
||||
+14
-1
@@ -11,7 +11,7 @@ pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
|
||||
fn parse_less_version(output: &[u8]) -> Option<usize> {
|
||||
if output.starts_with(b"less ") {
|
||||
let version = std::str::from_utf8(&output[5..]).ok()?;
|
||||
let end = version.find(' ')?;
|
||||
let end = version.find(|c: char| !c.is_ascii_digit())?;
|
||||
version[..end].parse::<usize>().ok()
|
||||
} else {
|
||||
None
|
||||
@@ -57,6 +57,19 @@ Home page: http://www.greenwoodsoftware.com/less";
|
||||
assert_eq!(Some(551), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_581_2() {
|
||||
let output = b"less 581.2 (PCRE2 regular expressions)
|
||||
Copyright (C) 1984-2021 Mark Nudelman
|
||||
|
||||
less comes with NO WARRANTY, to the extent permitted by law.
|
||||
For information about the terms of redistribution,
|
||||
see the file named README in the less distribution.
|
||||
Home page: https://greenwoodsoftware.com/less";
|
||||
|
||||
assert_eq!(Some(581), parse_less_version(output));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_less_version_wrong_program() {
|
||||
let output = b"more from util-linux 2.34";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::ffi::OsStr;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
use console::Term;
|
||||
use syntect::parsing::SyntaxReference;
|
||||
@@ -71,7 +71,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
}
|
||||
|
||||
/// Add a file which should be pretty-printed
|
||||
pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self {
|
||||
pub fn input_file(&mut self, path: impl AsRef<Path>) -> &mut Self {
|
||||
self.input(Input::from_file(path).kind("File"))
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ impl<'a> PrettyPrinter<'a> {
|
||||
pub fn input_files<I, P>(&mut self, paths: I) -> &mut Self
|
||||
where
|
||||
I: IntoIterator<Item = P>,
|
||||
P: AsRef<OsStr>,
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
self.inputs(paths.into_iter().map(Input::from_file))
|
||||
}
|
||||
@@ -297,8 +297,8 @@ impl<'a> Input<'a> {
|
||||
}
|
||||
|
||||
/// A new input from a file.
|
||||
pub fn from_file(path: impl AsRef<OsStr>) -> Self {
|
||||
input::Input::ordinary_file(path.as_ref()).into()
|
||||
pub fn from_file(path: impl AsRef<Path>) -> Self {
|
||||
input::Input::ordinary_file(path).into()
|
||||
}
|
||||
|
||||
/// A new input from bytes.
|
||||
@@ -313,8 +313,8 @@ impl<'a> Input<'a> {
|
||||
|
||||
/// The filename of the input.
|
||||
/// This affects syntax detection and changes the default header title.
|
||||
pub fn name(mut self, name: impl AsRef<OsStr>) -> Self {
|
||||
self.input = self.input.with_name(Some(name.as_ref()));
|
||||
pub fn name(mut self, name: impl AsRef<Path>) -> Self {
|
||||
self.input = self.input.with_name(Some(name));
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ fn all_themes_are_present() {
|
||||
"Solarized (light)",
|
||||
"Sublime Snazzy",
|
||||
"TwoDark",
|
||||
"Visual Studio Dark+",
|
||||
"ansi",
|
||||
"base16",
|
||||
"base16-256",
|
||||
|
||||
@@ -17,6 +17,9 @@ fn no_duplicate_extensions() {
|
||||
// The '.fs' extension appears in F# and GLSL.
|
||||
// We default to F#.
|
||||
"fs",
|
||||
// SystemVerilog and Verilog both use .v files.
|
||||
// We default to Verilog.
|
||||
"v",
|
||||
];
|
||||
|
||||
let assets = HighlightingAssets::from_binary();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[3;38;2;102;217;239mfirst[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mlast[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239maddress[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mcity[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mzip[0m
|
||||
[3;38;2;102;217;239mJohn[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mDoe[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;102;217;239ma[0m[38;2;249;38;114m,[0m[3;38;2;102;217;239mb[0m
|
||||
[38;2;190;132;255m1[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;248;248;242m [0m
|
||||
[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m
|
||||
[3;38;2;102;217;239mha[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[38;2;190;132;255m3[0m[38;2;249;38;114m,[0m[38;2;190;132;255m4[0m[38;2;249;38;114m,[0m[38;2;190;132;255m120[0m[38;2;248;248;242m [0m[3;38;2;102;217;239many[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mst.[0m[38;2;249;38;114m,[0m[38;2;230;219;116m"[0m[3;38;2;102;217;239mAnytown[0m[38;2;249;38;114m,[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mWW[0m[38;2;230;219;116m"[0m[38;2;249;38;114m,[0m[38;2;190;132;255m08123[0m
|
||||
[3;38;2;166;226;46mfirst[0m[38;2;253;151;31m,[0m[38;2;102;217;239mlast[0m[38;2;253;151;31m,[0m[38;2;190;132;255maddress[0m[38;2;253;151;31m,[0m[38;2;249;38;114mcity[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46mzip[0m
|
||||
[3;38;2;166;226;46mJohn[0m[38;2;253;151;31m,[0m[38;2;102;217;239mDoe[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46ma[0m[38;2;253;151;31m,[0m[38;2;102;217;239mb[0m
|
||||
[3;38;2;166;226;46m1[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mha [0m
|
||||
[38;2;190;132;255m""[0m[38;2;230;219;116mha[0m[38;2;190;132;255m""[0m[38;2;230;219;116m [0m
|
||||
[38;2;230;219;116mha[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
[3;38;2;166;226;46m3[0m[38;2;253;151;31m,[0m[38;2;102;217;239m4[0m[38;2;253;151;31m,[0m[38;2;190;132;255m120 any st.[0m[38;2;253;151;31m,[0m[38;2;230;219;116m"[0m[38;2;230;219;116mAnytown, WW[0m[38;2;230;219;116m"[0m[38;2;253;151;31m,[0m[3;38;2;166;226;46m08123[0m
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 276.
|
@@ -0,0 +1,2 @@
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;190;132;255m.[0m[38;2;190;132;255m392[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46m[[0m[4;38;2;190;132;255m2001[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255mdb8[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m4006[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m812[0m[4;38;2;166;226;46m:[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m200e[0m[4;38;2;166;226;46m][0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46mexample.com[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m(with_parens)[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
@@ -0,0 +1,376 @@
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m SPDX-License-Identifier: MIT[0m
|
||||
|
||||
[38;2;249;38;114mpragma[0m[38;2;248;248;242m [0m[38;2;249;38;114msolidity[0m[38;2;248;248;242m [0m[38;2;249;38;114m^[0m[38;2;190;132;255m0[0m[38;2;190;132;255m.8.0[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mi[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mI[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mM[0m[38;2;230;219;116me[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mA[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mC[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mt[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mS[0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mg[0m[38;2;230;219;116ms[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116m.[0m[38;2;230;219;116m.[0m[38;2;230;219;116m/[0m[38;2;230;219;116mu[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116ml[0m[38;2;230;219;116ms[0m[38;2;230;219;116m/[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116ms[0m[38;2;230;219;116mp[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116mt[0m[38;2;230;219;116mi[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116m/[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m1[0m[38;2;230;219;116m6[0m[38;2;230;219;116m5[0m[38;2;230;219;116m.[0m[38;2;230;219;116ms[0m[38;2;230;219;116mo[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including[0m
|
||||
[38;2;117;113;94m * the Metadata extension, but not including the Enumerable extension, which is available separately as[0m
|
||||
[38;2;117;113;94m * {ERC721Enumerable}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;249;38;114mcontract[0m[38;2;248;248;242m [0m[4;38;2;102;217;239mERC721[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mContext[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mERC165[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mIERC721[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mIERC721Metadata[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114musing[0m[38;2;248;248;242m Address [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114musing[0m[38;2;248;248;242m Strings [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Token name[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate [0m[38;2;248;248;242m_name[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Token symbol[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate [0m[38;2;248;248;242m_symbol[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from token ID to owner address[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _owners;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping owner address to token count[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _balances;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from token ID to approved address[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _tokenApprovals;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Mapping from owner to operator approvals[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mmapping[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;249;38;114m=>[0m[38;2;248;248;242m [0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m _operatorApprovals;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mconstructor[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m name_[0m[38;2;248;248;242m, [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m symbol_[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m_name[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m name_;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m_symbol[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m symbol_;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC165-supportsInterface}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msupportsInterface[0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes4[0m[38;2;248;248;242m [0m[3;38;2;253;151;31minterfaceId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m(ERC165, IERC165) [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m interfaceId [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mtype[0m[38;2;248;248;242m([0m[38;2;248;248;242mIERC721[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.interfaceId[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m interfaceId [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mtype[0m[38;2;248;248;242m([0m[38;2;248;248;242mIERC721Metadata[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.interfaceId[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;249;38;114msuper[0m[38;2;248;248;242m.[0m[38;2;102;217;239msupportsInterface[0m[38;2;248;248;242m([0m[38;2;248;248;242minterfaceId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-balanceOf}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mbalanceOf[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mowner[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(owner [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mb[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-ownerOf}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mownerOf[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(owner [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m owner;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721Metadata-name}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mname[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _name;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721Metadata-symbol}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msymbol[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _symbol;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721Metadata-tokenURI}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mtokenURI[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mM[0m[38;2;230;219;116me[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116ma[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mU[0m[38;2;230;219;116mR[0m[38;2;230;219;116mI[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory [0m[38;2;248;248;242mbaseURI[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239m_baseURI[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m([0m[38;2;248;248;242mbaseURI[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[3;38;2;166;226;46mlength[0m[38;2;248;248;242m [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m?[0m[38;2;248;248;242m [0m[38;2;190;132;255mstring[0m[38;2;248;248;242m([0m[38;2;102;217;239mabi.encodePacked[0m[38;2;248;248;242m(baseURI, [0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m.[0m[38;2;102;217;239mtoString[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden[0m
|
||||
[38;2;117;113;94m * in child contracts.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_baseURI[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-approve}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mapprove[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m owner, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116mu[0m[38;2;230;219;116mr[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m owner [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-getApproved}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mgetApproved[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _tokenApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-setApprovalForAll}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msetApprovalForAll[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperator[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbool[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mapproved[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(operator [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _operatorApprovals[0m[38;2;248;248;242m[[0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m][0m[38;2;248;248;242m[[0m[38;2;248;248;242moperator[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m approved;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mApprovalForAll[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, operator, approved[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-isApprovedForAll}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mowner[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperator[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _operatorApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[0m[38;2;248;248;242m][0m[38;2;248;248;242m[[0m[38;2;248;248;242moperator[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-transferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mtransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94msolhint-disable-next-line max-line-length[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_transfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-safeTransferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, [0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev See {IERC721-safeTransferFrom}.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46msafeTransferFrom[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mpublic[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114moverride[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mc[0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_safeTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients[0m
|
||||
[38;2;117;113;94m * are aware of the ERC721 protocol to prevent tokens from being forever locked.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * `_data` is additional data, it has no specified format and it is sent in call to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.[0m
|
||||
[38;2;117;113;94m * implement alternative mechanisms to perform token transfer, such as signature-based.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `from` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `tokenId` token must exist and be owned by `from`.[0m
|
||||
[38;2;117;113;94m * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_transfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Returns whether `tokenId` exists.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Tokens start existing when they are minted (`_mint`),[0m
|
||||
[38;2;117;113;94m * and stop existing when they are burned (`_burn`).[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_exists[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Returns whether `spender` is allowed to manage `tokenId`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must exist.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_isApprovedOrOwner[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mspender[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mview[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mp[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mq[0m[38;2;230;219;116mu[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mf[0m[38;2;230;219;116mo[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;230;219;116me[0m[38;2;230;219;116mx[0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mspender [0m[38;2;249;38;114m==[0m[38;2;248;248;242m owner [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239mgetApproved[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m spender [0m[38;2;249;38;114m||[0m[38;2;248;248;242m [0m[38;2;102;217;239misApprovedForAll[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, spender[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Safely mints `tokenId` and transfers it to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must not exist.[0m
|
||||
[38;2;117;113;94m * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeMint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_safeMint[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId, [0m[38;2;230;219;116m"[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is[0m
|
||||
[38;2;117;113;94m * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_safeMint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_mint[0m[38;2;248;248;242m([0m[38;2;248;248;242mto, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;102;217;239m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Mints `tokenId` and transfers it to `to`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must not exist.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_mint[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mm[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;249;38;114m![0m[38;2;102;217;239m_exists[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116ml[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116my[0m[38;2;248;248;242m [0m[38;2;230;219;116mm[0m[38;2;230;219;116mi[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116md[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mto[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Destroys `tokenId`.[0m
|
||||
[38;2;117;113;94m * The approval is cleared when the token is burned.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `tokenId` must exist.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_burn[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[38;2;248;248;242mowner[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Clear approvals[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mowner[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mdelete[0m[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mowner, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Transfers `tokenId` from `from` to `to`.[0m
|
||||
[38;2;117;113;94m * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Requirements:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `tokenId` token must be owned by `from`.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Transfer} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_transfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m([0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m from, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mf[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116ma[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116ms[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mt[0m[38;2;248;248;242m [0m[38;2;230;219;116mo[0m[38;2;230;219;116mw[0m[38;2;230;219;116mn[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrequire[0m[38;2;248;248;242m(to [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;248;248;242m [0m[38;2;230;219;116mz[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116ma[0m[38;2;230;219;116md[0m[38;2;230;219;116md[0m[38;2;230;219;116mr[0m[38;2;230;219;116me[0m[38;2;230;219;116ms[0m[38;2;230;219;116ms[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Clear approvals from the previous owner[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mfrom[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _balances[0m[38;2;248;248;242m[[0m[38;2;248;248;242mto[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m _owners[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mTransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242mfrom, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Approve `to` to operate on `tokenId`[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Emits a {Approval} event.[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_approve[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m _tokenApprovals[0m[38;2;248;248;242m[[0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m to;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114memit[0m[38;2;248;248;242m [0m[38;2;102;217;239mApproval[0m[38;2;248;248;242m([0m[38;2;248;248;242mERC721[0m[38;2;248;248;242m.[0m[38;2;102;217;239mownerOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, to, tokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.[0m
|
||||
[38;2;117;113;94m * The call is not executed if the target address is not a contract.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * @param from address representing the previous owner of the given token ID[0m
|
||||
[38;2;117;113;94m * @param to target address that will receive the tokens[0m
|
||||
[38;2;117;113;94m * @param tokenId uint256 ID of the token to be transferred[0m
|
||||
[38;2;117;113;94m * @param _data bytes optional data to send along with the call[0m
|
||||
[38;2;117;113;94m * @return bool whether the call correctly returned the expected magic value[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_checkOnERC721Received[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m, [0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m _data[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbool[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m.[0m[38;2;102;217;239misContract[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtry[0m[38;2;248;248;242m [0m[38;2;102;217;239mIERC721Receiver[0m[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239monERC721Received[0m[38;2;248;248;242m([0m[38;2;102;217;239m_msgSender[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m, from, tokenId, _data[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturns[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes4[0m[38;2;248;248;242m [0m[38;2;248;248;242mretval[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m retval [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;102;217;239mIERC721Receiver[0m[38;2;248;248;242m([0m[38;2;248;248;242mto[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.onERC721Received.[0m[38;2;249;38;114mselector[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114mcatch[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;190;132;255mbytes[0m[38;2;248;248;242m [0m[38;2;249;38;114mmemory[0m[3;38;2;253;151;31m reason[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mreason.[0m[3;38;2;166;226;46mlength[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m 0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrevert[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116m:[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mr[0m[38;2;230;219;116ma[0m[38;2;230;219;116mn[0m[38;2;230;219;116ms[0m[38;2;230;219;116mf[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mt[0m[38;2;230;219;116mo[0m[38;2;248;248;242m [0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116mn[0m[38;2;248;248;242m [0m[38;2;230;219;116mE[0m[38;2;230;219;116mR[0m[38;2;230;219;116mC[0m[38;2;230;219;116m7[0m[38;2;230;219;116m2[0m[38;2;230;219;116m1[0m[38;2;230;219;116mR[0m[38;2;230;219;116me[0m[38;2;230;219;116mc[0m[38;2;230;219;116me[0m[38;2;230;219;116mi[0m[38;2;230;219;116mv[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;248;248;242m [0m[38;2;230;219;116mi[0m[38;2;230;219;116mm[0m[38;2;230;219;116mp[0m[38;2;230;219;116ml[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116me[0m[38;2;230;219;116mn[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m solhint-disable-next-line no-inline-assembly[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239massembly[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mrevert[0m[38;2;248;248;242m([0m[38;2;102;217;239madd[0m[38;2;248;248;242m([0m[38;2;190;132;255m32[0m[38;2;248;248;242m, reason), [0m[38;2;102;217;239mmload[0m[38;2;248;248;242m(reason))[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/**[0m
|
||||
[38;2;117;113;94m * @dev Hook that is called before any token transfer. This includes minting[0m
|
||||
[38;2;117;113;94m * and burning.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * Calling conditions:[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be[0m
|
||||
[38;2;117;113;94m * transferred to `to`.[0m
|
||||
[38;2;117;113;94m * - When `from` is zero, `tokenId` will be minted for `to`.[0m
|
||||
[38;2;117;113;94m * - When `to` is zero, ``from``'s `tokenId` will be burned.[0m
|
||||
[38;2;117;113;94m * - `from` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m * - `to` cannot be the zero address.[0m
|
||||
[38;2;117;113;94m *[0m
|
||||
[38;2;117;113;94m * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46m_beforeTokenTransfer[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mfrom[0m[38;2;248;248;242m, [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mto[0m[38;2;248;248;242m, [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mtokenId[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114minternal[0m[38;2;248;248;242m [0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
@@ -0,0 +1,11 @@
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m logrotate.service: Succeeded.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Finished Rotate log files.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mcolord[0m[38;2;248;248;242m[[0m[38;2;190;132;255m920[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;240mfailed[0m[38;2;248;248;242m to get session [pid [0m[38;2;190;132;255m137485[0m[38;2;248;248;242m]: No data available[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mkernel[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31m55604[0m[38;2;248;248;242m.[0m[3;38;2;253;151;31m908232[0m[38;2;248;248;242m][0m[38;2;248;248;242m audit: [0m[3;38;2;253;151;31mtype[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1400[0m[38;2;248;248;242m audit([0m[38;2;190;132;255m1617483621[0m[38;2;190;132;255m.[0m[38;2;190;132;255m094[0m[38;2;248;248;242m:[0m[38;2;190;132;255m28[0m[38;2;248;248;242m): [0m[3;38;2;253;151;31mapparmor[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mDENIED[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperation[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcapable[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mprofile[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116m/usr/sbin/cups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m59311[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcomm[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapability[0m[38;2;249;38;114m=[0m[38;2;190;132;255m23[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapname[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116msys_nice[0m[38;2;230;219;116m"[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:01:38[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd-resolved[0m[38;2;248;248;242m[[0m[38;2;190;132;255m721[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Server returned [0m[38;2;248;248;240merror[0m[38;2;248;248;242m NXDOMAIN, mitigating potential DNS violation DVE-[0m[38;2;190;132;255m2018[0m[38;2;248;248;242m-[0m[38;2;190;132;255m0001[0m[38;2;248;248;242m, retrying transaction with reduced feature level UDP.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:04:46[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Soliciting pool server [0m[38;2;190;132;255m255[0m[38;2;248;248;242m.[0m[38;2;190;132;255m76[0m[38;2;248;248;242m.[0m[38;2;190;132;255m59[0m[38;2;248;248;242m.[0m[38;2;190;132;255m37[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:05:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m:[0m[38;2;248;248;242m:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m local addr [0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m -> [0m[38;2;190;132;255m<null>[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:06:29[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m receive: Unexpected origin timestamp [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d1[0m[38;2;190;132;255m.[0m[38;2;190;132;255m82e825f5[0m[38;2;248;248;242m does not match aorg [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d5[0m[38;2;190;132;255m.[0m[38;2;190;132;255m82c50d8c[0m[38;2;248;248;242m from server@[0m[38;2;190;132;255m127[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;190;132;255m0[0m[38;2;248;248;242m.[0m[38;2;190;132;255m1[0m[38;2;248;248;242m xmt [0m[38;2;190;132;255m0x[0m[38;2;190;132;255me414a8d1[0m[38;2;190;132;255m.[0m[38;2;190;132;255me671d7c4[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m09:30:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mCRON[0m[38;2;248;248;242m[[0m[38;2;190;132;255m89278[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m (root) [0m[38;2;166;226;46mCMD[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;102;217;239m[[0m[38;2;255;255;255m [0m[3;38;2;253;151;31m-[0m[3;38;2;253;151;31mx[0m[38;2;255;255;255m /etc/init.d/anacron [0m[38;2;102;217;239m][0m[38;2;255;255;255m [0m[38;2;249;38;114m&&[0m[38;2;255;255;255m [0m[38;2;249;38;114mif[0m[38;2;255;255;255m [0m[38;2;102;217;239m[[0m[38;2;255;255;255m [0m[38;2;249;38;114m![0m[38;2;255;255;255m [0m[3;38;2;253;151;31m-[0m[3;38;2;253;151;31md[0m[38;2;255;255;255m /run/systemd/system [0m[38;2;102;217;239m][0m[38;2;249;38;114m;[0m[38;2;255;255;255m [0m[38;2;249;38;114mthen[0m[38;2;255;255;255m [0m[38;2;255;255;255m/usr/sbin/invoke-rc.d[0m[38;2;255;255;255m anacron start [0m[38;2;249;38;114m>[0m[38;2;255;255;255m/dev/null[0m[38;2;249;38;114m;[0m[38;2;255;255;255m [0m[38;2;249;38;114mfi[0m[38;2;248;248;242m)[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m16:32:07[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mNetworkManager[0m[38;2;248;248;242m[[0m[38;2;190;132;255m740[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m<info>[0m[38;2;248;248;242m [[0m[38;2;190;132;255m1617629527[0m[38;2;190;132;255m.[0m[38;2;190;132;255m1101[0m[38;2;248;248;242m] manager: NetworkManager state is now CONNECTED_GLOBAL[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m22:00:45[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mdbus-daemon[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1094[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31msession[0m[38;2;248;248;242m [0m[3;38;2;253;151;31muid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1000[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1094[0m[38;2;248;248;242m][0m[38;2;248;248;242m Successfully activated service [0m[38;2;230;219;116m'[0m[38;2;230;219;116mio.github.celluloid_player.Celluloid[0m[38;2;230;219;116m'[0m
|
||||
@@ -0,0 +1,103 @@
|
||||
[38;2;190;132;255m`timescale[0m[38;2;248;248;242m [0m[38;2;190;132;255m1ns[0m[38;2;249;38;114m/[0m[38;2;190;132;255m1ps[0m
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Design Code[0m
|
||||
[38;2;249;38;114mmodule[0m[38;2;248;248;242m [0m[38;2;166;226;46mADDER[0m[38;2;248;248;242m([0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m clk,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] a,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] b,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m bIsPos,[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46moutput[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mreg[0m[38;2;248;248;242m [[0m[38;2;190;132;255m8[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] result[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114malways[0m[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;248;248;242m ([0m[38;2;249;38;114mposedge[0m[38;2;248;248;242m clk) [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m (bIsPos) [0m[38;2;249;38;114mbegin[0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114m+[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m result [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a [0m[38;2;249;38;114m-[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
|
||||
[38;2;249;38;114mendmodule[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mADDER[0m
|
||||
|
||||
[38;2;249;38;114minterface[0m[38;2;248;248;242m [0m[38;2;166;226;46madder_if[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[3;38;2;166;226;46minput[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mbit[0m[38;2;248;248;242m clk,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] a,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m7[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] b,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m bIsPos,[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m [[0m[38;2;190;132;255m8[0m[38;2;249;38;114m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m] result[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mclocking[0m[38;2;248;248;242m cb [0m[38;2;249;38;114m@[0m[38;2;248;248;242m([0m[38;2;249;38;114mposedge[0m[38;2;248;248;242m clk);[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m a;[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m b;[0m
|
||||
[3;38;2;166;226;46m output[0m[38;2;248;248;242m bIsPos;[0m
|
||||
[3;38;2;166;226;46m input[0m[38;2;248;248;242m result;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendclocking[0m[38;2;248;248;242m [0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mcb[0m
|
||||
|
||||
[38;2;249;38;114mendinterface[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46madder_if[0m
|
||||
|
||||
|
||||
[38;2;249;38;114mbind[0m[38;2;248;248;242m ADDER [0m[3;38;2;102;217;239madder_if[0m[38;2;248;248;242m [0m[38;2;166;226;46mmy_adder_if[0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mclk[0m[38;2;248;248;242m(clk),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239ma[0m[38;2;248;248;242m(a),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mb[0m[38;2;248;248;242m(b),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mbIsPos[0m[38;2;248;248;242m(bIsPos),[0m
|
||||
[38;2;248;248;242m .[0m[38;2;102;217;239mresult[0m[38;2;248;248;242m(result)[0m
|
||||
[38;2;248;248;242m);[0m
|
||||
|
||||
|
||||
[38;2;117;113;94m//[0m[38;2;117;113;94m Testbench Code[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[3;38;2;166;226;46muvm_pkg[0m[38;2;249;38;114m::[0m[38;2;249;38;114m*[0m[38;2;248;248;242m;[0m
|
||||
[38;2;190;132;255m`include[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116muvm_macros.svh[0m[38;2;230;219;116m"[0m
|
||||
|
||||
[38;2;249;38;114mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mtestbench_env[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[3;4;38;2;166;226;46muvm_env[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mvirtual [0m[3;38;2;102;217;239madder_if[0m[38;2;248;248;242m [0m[38;2;248;248;242mm_if;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mnew[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mstring[0m[38;2;248;248;242m name, [0m[3;38;2;102;217;239muvm_component[0m[38;2;248;248;242m parent [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239mnull[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114msuper[0m[38;2;248;248;242m.[0m[38;2;249;38;114mnew[0m[38;2;248;248;242m(name, parent);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfunction[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[3;38;2;102;217;239m void[0m[38;2;248;248;242m [0m[38;2;166;226;46mconnect_phase[0m[38;2;248;248;242m([0m[3;38;2;102;217;239muvm_phase[0m[38;2;248;248;242m phase[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m(uvm_resource_db[0m[38;2;249;38;114m#[0m[38;2;248;248;242m([0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m adder_if)[0m[38;2;249;38;114m:[0m[38;2;249;38;114m:[0m[38;2;102;217;239mread_by_name[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_full_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116madder_if[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, m_if));[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendfunction[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mconnect_phase[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtask[0m[38;2;248;248;242m [0m[38;2;166;226;46mrun_phase[0m[38;2;248;248;242m([0m[3;38;2;102;217;239muvm_phase[0m[38;2;248;248;242m phase[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m phase.[0m[38;2;102;217;239mraise_objection[0m[38;2;248;248;242m([0m[38;2;249;38;114mthis[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116mStarting test![0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;190;132;255mUVM_HIGH[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[3;38;2;102;217;239m int[0m[38;2;248;248;242m a [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8'h4[0m[38;2;248;248;242m, b [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m8'h5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m@[0m[38;2;248;248;242m(m_if.cb);[0m
|
||||
[38;2;248;248;242m m_if.cb.a [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m a;[0m
|
||||
[38;2;248;248;242m m_if.cb.b [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m b;[0m
|
||||
[38;2;248;248;242m m_if.cb.bIsPos [0m[38;2;249;38;114m<=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1'b1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mrepeat[0m[38;2;248;248;242m([0m[38;2;190;132;255m2[0m[38;2;248;248;242m) [0m[38;2;249;38;114m@[0m[38;2;248;248;242m(m_if.cb);[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;102;217;239m$sformatf[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m + [0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m = [0m[38;2;190;132;255m%0d[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, a, b, m_if.cb.result), [0m[38;2;190;132;255mUVM_LOW[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m`uvm_info[0m[38;2;248;248;242m([0m[38;2;102;217;239mget_name[0m[38;2;248;248;242m(), [0m[38;2;230;219;116m"[0m[38;2;230;219;116mEnding test![0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;190;132;255mUVM_HIGH[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m phase.[0m[38;2;102;217;239mdrop_objection[0m[38;2;248;248;242m([0m[38;2;249;38;114mthis[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mendtask[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mrun_phase[0m
|
||||
[38;2;249;38;114mendclass[0m
|
||||
|
||||
|
||||
[38;2;249;38;114mmodule[0m[38;2;248;248;242m [0m[38;2;166;226;46mtop[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[3;38;2;102;217;239m bit[0m[38;2;248;248;242m clk;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239menv[0m[38;2;248;248;242m [0m[38;2;248;248;242menvironment;[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mADDER[0m[38;2;248;248;242m [0m[38;2;166;226;46mdut[0m[38;2;248;248;242m(.[0m[38;2;102;217;239mclk[0m[38;2;248;248;242m (clk));[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minitial[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242menvironment [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mtestbench_env[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239muvm_resource_db[0m[38;2;249;38;114m#[0m[38;2;248;248;242m([0m[38;2;249;38;114mvirtual[0m[38;2;248;248;242m adder_if)[0m[38;2;249;38;114m:[0m[38;2;249;38;114m:[0m[38;2;102;217;239mset[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116menv[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116madder_if[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, dut.my_adder_if);[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mclk [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239mrun_test[0m[38;2;248;248;242m();[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m Clock generation [0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114minitial[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mforever[0m[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114m#[0m[38;2;248;248;242m([0m[38;2;190;132;255m1[0m[38;2;248;248;242m) clk [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m~[0m[38;2;248;248;242mclk;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;249;38;114mendmodule[0m
|
||||
@@ -0,0 +1,89 @@
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m IndividuallyCappedCrowdsale[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Contributors: Binod Nirvan[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m This file is released under Apache 2.0 license.[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m @dev Crowdsale with a limit for total contributions.[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Ported from Open Zeppelin[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m https://github.com/OpenZeppelin[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m [0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m See https://github.com/OpenZeppelin[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Open Zeppelin tests ported: Crowdsale.test.js[0m
|
||||
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m@dev ERC20/223 Features referenced by this contract[0m
|
||||
[38;2;249;38;114mcontract[0m[38;2;248;248;242m [0m[4;38;2;102;217;239mTokenContract[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mtransfer[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m_to[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m_value[0m[38;2;248;248;242m: [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;190;132;255mbool[0m[38;2;249;38;114m:[0m[38;2;248;248;242m modifying[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m Event for token purchase logging[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m @param _purchaser who paid for the tokens[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m @param _beneficiary who got the tokens[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m @param _value weis paid for purchase[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m @param _amount amount of tokens purchased[0m
|
||||
[38;2;248;248;242mTokenPurchase[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mevent[0m[38;2;248;248;242m([0m[38;2;248;248;242m{_purchaser[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mindexed[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, _beneficiary[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mindexed[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, _value[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m(wei[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, _amount[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m})[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m The token being sold[0m
|
||||
[38;2;248;248;242mtoken[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mpublic[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94mAddress where funds are collected[0m
|
||||
[38;2;248;248;242mwallet[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mpublic[0m[38;2;248;248;242m([0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m How many token units a buyer gets per wei.[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m The rate is the conversion between wei and the smallest and indivisible token unit.[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m 1 wei will give you 1 unit, or 0.001 TOK.[0m
|
||||
[38;2;248;248;242mrate[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mpublic[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94mAmount of wei raised[0m
|
||||
[38;2;248;248;242mweiRaised[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mpublic[0m[38;2;248;248;242m([0m[38;2;190;132;255muint256[0m[38;2;248;248;242m(wei[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;249;38;114m@public[0m
|
||||
[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46m__init__[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m_rate[0m[38;2;248;248;242m: [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m_wallet[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m_token[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m"""[0m
|
||||
[38;2;117;113;94m [0m[38;2;230;219;116m@dev[0m[38;2;117;113;94m Initializes this contract[0m
|
||||
[38;2;117;113;94m [0m[38;2;230;219;116m@param[0m[38;2;117;113;94m _rate Number of token units a buyer gets per wei[0m
|
||||
[38;2;117;113;94m [0m[38;2;230;219;116m@param[0m[38;2;117;113;94m _wallet Address where collected funds will be forwarded to[0m
|
||||
[38;2;117;113;94m [0m[38;2;230;219;116m@param[0m[38;2;117;113;94m _token Address of the token being sold[0m
|
||||
[38;2;117;113;94m [0m[38;2;117;113;94m"""[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m _rate [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"Invalid value supplied for the parameter \"[0m[38;2;248;248;242m_rate\[0m[38;2;230;219;116m"."[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m _wallet [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m ZERO_ADDRESS, [0m[38;2;230;219;116m"Invalid wallet address."[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m _token [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m ZERO_ADDRESS, [0m[38;2;230;219;116m"Invalid token address."[0m
|
||||
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.rate [0m[38;2;249;38;114m=[0m[38;2;248;248;242m _rate[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.wallet [0m[38;2;249;38;114m=[0m[38;2;248;248;242m _wallet[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.token [0m[38;2;249;38;114m=[0m[38;2;248;248;242m _token[0m
|
||||
|
||||
[38;2;249;38;114m@private[0m
|
||||
[38;2;249;38;114m@constant[0m
|
||||
[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mgetTokenAmount[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m_weiAmount[0m[38;2;248;248;242m: [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m->[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m _weiAmount [0m[38;2;249;38;114m*[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.rate[0m
|
||||
|
||||
|
||||
[38;2;249;38;114m@private[0m
|
||||
[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mprocessTransaction[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m_sender[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m_beneficiary[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m, [0m[3;38;2;253;151;31m_weiAmount[0m[38;2;248;248;242m: [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m([0m[38;2;248;248;242mwei[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94mpre validate[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m _beneficiary [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m ZERO_ADDRESS, [0m[38;2;230;219;116m"Invalid address."[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m _weiAmount [0m[38;2;249;38;114m!=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"Invalid amount received."[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94mcalculate the number of tokens for the Ether contribution.[0m
|
||||
[38;2;248;248;242m tokens[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;190;132;255muint256[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.[0m[38;2;102;217;239mgetTokenAmount[0m[38;2;248;248;242m([0m[38;2;102;217;239mas_unitless_number[0m[38;2;248;248;242m([0m[38;2;248;248;242m_weiAmount[0m[38;2;248;248;242m)[0m[38;2;248;248;242m)[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.weiRaised [0m[38;2;249;38;114m+[0m[38;2;249;38;114m=[0m[38;2;248;248;242m _weiAmount[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94mprocess purchase[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114massert[0m[38;2;248;248;242m [0m[38;2;102;217;239mTokenContract[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.token[0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;102;217;239mtransfer[0m[38;2;248;248;242m([0m[38;2;248;248;242m_beneficiary, tokens[0m[38;2;248;248;242m)[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"Could not forward funds due to an unknown error."[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mlog[0m[38;2;248;248;242m.[0m[38;2;102;217;239mTokenPurchase[0m[38;2;248;248;242m([0m[38;2;248;248;242m_sender, _beneficiary, _weiAmount, tokens[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94mforward funds to the receiving wallet address.[0m
|
||||
[38;2;248;248;242m [0m[38;2;102;217;239msend[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.wallet, _weiAmount[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94mpost validate[0m
|
||||
|
||||
[38;2;249;38;114m@public[0m
|
||||
[38;2;249;38;114m@payable[0m
|
||||
[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mbuyTokens[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m_beneficiary[0m[38;2;248;248;242m: [0m[38;2;190;132;255maddress[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.[0m[38;2;102;217;239mprocessTransaction[0m[38;2;248;248;242m([0m[38;2;190;132;255mmsg.sender[0m[38;2;248;248;242m, _beneficiary, [0m[38;2;190;132;255mmsg.value[0m[38;2;248;248;242m)[0m
|
||||
|
||||
[38;2;249;38;114m@public[0m
|
||||
[38;2;249;38;114m@payable[0m
|
||||
[3;38;2;102;217;239mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46m__default__[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mself[0m[38;2;248;248;242m.[0m[38;2;102;217;239mprocessTransaction[0m[38;2;248;248;242m([0m[38;2;190;132;255mmsg.sender[0m[38;2;248;248;242m, [0m[38;2;190;132;255mmsg.sender[0m[38;2;248;248;242m, [0m[38;2;190;132;255mmsg.value[0m[38;2;248;248;242m)[0m
|
||||
@@ -0,0 +1,2 @@
|
||||
2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html
|
||||
2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html
|
||||
@@ -0,0 +1,376 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./IERC721.sol";
|
||||
import "./IERC721Receiver.sol";
|
||||
import "./extensions/IERC721Metadata.sol";
|
||||
import "../../utils/Address.sol";
|
||||
import "../../utils/Context.sol";
|
||||
import "../../utils/Strings.sol";
|
||||
import "../../utils/introspection/ERC165.sol";
|
||||
|
||||
/**
|
||||
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
|
||||
* the Metadata extension, but not including the Enumerable extension, which is available separately as
|
||||
* {ERC721Enumerable}.
|
||||
*/
|
||||
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
|
||||
using Address for address;
|
||||
using Strings for uint256;
|
||||
|
||||
// Token name
|
||||
string private _name;
|
||||
|
||||
// Token symbol
|
||||
string private _symbol;
|
||||
|
||||
// Mapping from token ID to owner address
|
||||
mapping (uint256 => address) private _owners;
|
||||
|
||||
// Mapping owner address to token count
|
||||
mapping (address => uint256) private _balances;
|
||||
|
||||
// Mapping from token ID to approved address
|
||||
mapping (uint256 => address) private _tokenApprovals;
|
||||
|
||||
// Mapping from owner to operator approvals
|
||||
mapping (address => mapping (address => bool)) private _operatorApprovals;
|
||||
|
||||
/**
|
||||
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
|
||||
*/
|
||||
constructor (string memory name_, string memory symbol_) {
|
||||
_name = name_;
|
||||
_symbol = symbol_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC165-supportsInterface}.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
|
||||
return interfaceId == type(IERC721).interfaceId
|
||||
|| interfaceId == type(IERC721Metadata).interfaceId
|
||||
|| super.supportsInterface(interfaceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-balanceOf}.
|
||||
*/
|
||||
function balanceOf(address owner) public view virtual override returns (uint256) {
|
||||
require(owner != address(0), "ERC721: balance query for the zero address");
|
||||
return _balances[owner];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-ownerOf}.
|
||||
*/
|
||||
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
|
||||
address owner = _owners[tokenId];
|
||||
require(owner != address(0), "ERC721: owner query for nonexistent token");
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721Metadata-name}.
|
||||
*/
|
||||
function name() public view virtual override returns (string memory) {
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721Metadata-symbol}.
|
||||
*/
|
||||
function symbol() public view virtual override returns (string memory) {
|
||||
return _symbol;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721Metadata-tokenURI}.
|
||||
*/
|
||||
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
|
||||
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
|
||||
|
||||
string memory baseURI = _baseURI();
|
||||
return bytes(baseURI).length > 0
|
||||
? string(abi.encodePacked(baseURI, tokenId.toString()))
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
|
||||
* in child contracts.
|
||||
*/
|
||||
function _baseURI() internal view virtual returns (string memory) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-approve}.
|
||||
*/
|
||||
function approve(address to, uint256 tokenId) public virtual override {
|
||||
address owner = ERC721.ownerOf(tokenId);
|
||||
require(to != owner, "ERC721: approval to current owner");
|
||||
|
||||
require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
|
||||
"ERC721: approve caller is not owner nor approved for all"
|
||||
);
|
||||
|
||||
_approve(to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-getApproved}.
|
||||
*/
|
||||
function getApproved(uint256 tokenId) public view virtual override returns (address) {
|
||||
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
|
||||
|
||||
return _tokenApprovals[tokenId];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-setApprovalForAll}.
|
||||
*/
|
||||
function setApprovalForAll(address operator, bool approved) public virtual override {
|
||||
require(operator != _msgSender(), "ERC721: approve to caller");
|
||||
|
||||
_operatorApprovals[_msgSender()][operator] = approved;
|
||||
emit ApprovalForAll(_msgSender(), operator, approved);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-isApprovedForAll}.
|
||||
*/
|
||||
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
|
||||
return _operatorApprovals[owner][operator];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-transferFrom}.
|
||||
*/
|
||||
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
|
||||
//solhint-disable-next-line max-line-length
|
||||
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
|
||||
|
||||
_transfer(from, to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-safeTransferFrom}.
|
||||
*/
|
||||
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
|
||||
safeTransferFrom(from, to, tokenId, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev See {IERC721-safeTransferFrom}.
|
||||
*/
|
||||
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
|
||||
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
|
||||
_safeTransfer(from, to, tokenId, _data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
|
||||
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
|
||||
*
|
||||
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
|
||||
*
|
||||
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
|
||||
* implement alternative mechanisms to perform token transfer, such as signature-based.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `from` cannot be the zero address.
|
||||
* - `to` cannot be the zero address.
|
||||
* - `tokenId` token must exist and be owned by `from`.
|
||||
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
|
||||
*
|
||||
* Emits a {Transfer} event.
|
||||
*/
|
||||
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
|
||||
_transfer(from, to, tokenId);
|
||||
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns whether `tokenId` exists.
|
||||
*
|
||||
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
|
||||
*
|
||||
* Tokens start existing when they are minted (`_mint`),
|
||||
* and stop existing when they are burned (`_burn`).
|
||||
*/
|
||||
function _exists(uint256 tokenId) internal view virtual returns (bool) {
|
||||
return _owners[tokenId] != address(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns whether `spender` is allowed to manage `tokenId`.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `tokenId` must exist.
|
||||
*/
|
||||
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
|
||||
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
|
||||
address owner = ERC721.ownerOf(tokenId);
|
||||
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Safely mints `tokenId` and transfers it to `to`.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `tokenId` must not exist.
|
||||
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
|
||||
*
|
||||
* Emits a {Transfer} event.
|
||||
*/
|
||||
function _safeMint(address to, uint256 tokenId) internal virtual {
|
||||
_safeMint(to, tokenId, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
|
||||
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
|
||||
*/
|
||||
function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
|
||||
_mint(to, tokenId);
|
||||
require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Mints `tokenId` and transfers it to `to`.
|
||||
*
|
||||
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `tokenId` must not exist.
|
||||
* - `to` cannot be the zero address.
|
||||
*
|
||||
* Emits a {Transfer} event.
|
||||
*/
|
||||
function _mint(address to, uint256 tokenId) internal virtual {
|
||||
require(to != address(0), "ERC721: mint to the zero address");
|
||||
require(!_exists(tokenId), "ERC721: token already minted");
|
||||
|
||||
_beforeTokenTransfer(address(0), to, tokenId);
|
||||
|
||||
_balances[to] += 1;
|
||||
_owners[tokenId] = to;
|
||||
|
||||
emit Transfer(address(0), to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Destroys `tokenId`.
|
||||
* The approval is cleared when the token is burned.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `tokenId` must exist.
|
||||
*
|
||||
* Emits a {Transfer} event.
|
||||
*/
|
||||
function _burn(uint256 tokenId) internal virtual {
|
||||
address owner = ERC721.ownerOf(tokenId);
|
||||
|
||||
_beforeTokenTransfer(owner, address(0), tokenId);
|
||||
|
||||
// Clear approvals
|
||||
_approve(address(0), tokenId);
|
||||
|
||||
_balances[owner] -= 1;
|
||||
delete _owners[tokenId];
|
||||
|
||||
emit Transfer(owner, address(0), tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Transfers `tokenId` from `from` to `to`.
|
||||
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `to` cannot be the zero address.
|
||||
* - `tokenId` token must be owned by `from`.
|
||||
*
|
||||
* Emits a {Transfer} event.
|
||||
*/
|
||||
function _transfer(address from, address to, uint256 tokenId) internal virtual {
|
||||
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
|
||||
require(to != address(0), "ERC721: transfer to the zero address");
|
||||
|
||||
_beforeTokenTransfer(from, to, tokenId);
|
||||
|
||||
// Clear approvals from the previous owner
|
||||
_approve(address(0), tokenId);
|
||||
|
||||
_balances[from] -= 1;
|
||||
_balances[to] += 1;
|
||||
_owners[tokenId] = to;
|
||||
|
||||
emit Transfer(from, to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Approve `to` to operate on `tokenId`
|
||||
*
|
||||
* Emits a {Approval} event.
|
||||
*/
|
||||
function _approve(address to, uint256 tokenId) internal virtual {
|
||||
_tokenApprovals[tokenId] = to;
|
||||
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
|
||||
* The call is not executed if the target address is not a contract.
|
||||
*
|
||||
* @param from address representing the previous owner of the given token ID
|
||||
* @param to target address that will receive the tokens
|
||||
* @param tokenId uint256 ID of the token to be transferred
|
||||
* @param _data bytes optional data to send along with the call
|
||||
* @return bool whether the call correctly returned the expected magic value
|
||||
*/
|
||||
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
|
||||
private returns (bool)
|
||||
{
|
||||
if (to.isContract()) {
|
||||
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
|
||||
return retval == IERC721Receiver(to).onERC721Received.selector;
|
||||
} catch (bytes memory reason) {
|
||||
if (reason.length == 0) {
|
||||
revert("ERC721: transfer to non ERC721Receiver implementer");
|
||||
} else {
|
||||
// solhint-disable-next-line no-inline-assembly
|
||||
assembly {
|
||||
revert(add(32, reason), mload(reason))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Hook that is called before any token transfer. This includes minting
|
||||
* and burning.
|
||||
*
|
||||
* Calling conditions:
|
||||
*
|
||||
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
|
||||
* transferred to `to`.
|
||||
* - When `from` is zero, `tokenId` will be minted for `to`.
|
||||
* - When `to` is zero, ``from``'s `tokenId` will be burned.
|
||||
* - `from` cannot be the zero address.
|
||||
* - `to` cannot be the zero address.
|
||||
*
|
||||
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
|
||||
*/
|
||||
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
The `ERC721.sol` file has been added from
|
||||
[](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol)
|
||||
under the following license:
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2020 zOS Global Limited
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
|
||||
Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
|
||||
Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available
|
||||
Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice"
|
||||
Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
|
||||
Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37
|
||||
Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 -> <null>
|
||||
Apr 4 00:06:29 hostname-here ntpd[952]: receive: Unexpected origin timestamp 0xe414a8d1.82e825f5 does not match aorg 0xe414a8d5.82c50d8c from server@127.0.0.1 xmt 0xe414a8d1.e671d7c4
|
||||
Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
|
||||
Apr 4 16:32:07 hostname-here NetworkManager[740]: <info> [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL
|
||||
Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'
|
||||
@@ -0,0 +1,103 @@
|
||||
`timescale 1ns/1ps
|
||||
|
||||
// Design Code
|
||||
module ADDER(
|
||||
input clk,
|
||||
input [7:0] a,
|
||||
input [7:0] b,
|
||||
input bIsPos,
|
||||
output reg [8:0] result
|
||||
);
|
||||
|
||||
always @ (posedge clk) begin
|
||||
if (bIsPos) begin
|
||||
result <= a + b;
|
||||
end else begin
|
||||
result <= a - b;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule: ADDER
|
||||
|
||||
interface adder_if(
|
||||
input bit clk,
|
||||
input [7:0] a,
|
||||
input [7:0] b,
|
||||
input bIsPos,
|
||||
input [8:0] result
|
||||
);
|
||||
|
||||
clocking cb @(posedge clk);
|
||||
output a;
|
||||
output b;
|
||||
output bIsPos;
|
||||
input result;
|
||||
endclocking : cb
|
||||
|
||||
endinterface: adder_if
|
||||
|
||||
|
||||
bind ADDER adder_if my_adder_if(
|
||||
.clk(clk),
|
||||
.a(a),
|
||||
.b(b),
|
||||
.bIsPos(bIsPos),
|
||||
.result(result)
|
||||
);
|
||||
|
||||
|
||||
// Testbench Code
|
||||
import uvm_pkg::*;
|
||||
`include "uvm_macros.svh"
|
||||
|
||||
class testbench_env extends uvm_env;
|
||||
|
||||
virtual adder_if m_if;
|
||||
|
||||
function new(string name, uvm_component parent = null);
|
||||
super.new(name, parent);
|
||||
endfunction
|
||||
|
||||
function void connect_phase(uvm_phase phase);
|
||||
assert(uvm_resource_db#(virtual adder_if)::read_by_name(get_full_name(), "adder_if", m_if));
|
||||
endfunction: connect_phase
|
||||
|
||||
task run_phase(uvm_phase phase);
|
||||
phase.raise_objection(this);
|
||||
`uvm_info(get_name(), "Starting test!", UVM_HIGH);
|
||||
begin
|
||||
int a = 8'h4, b = 8'h5;
|
||||
@(m_if.cb);
|
||||
m_if.cb.a <= a;
|
||||
m_if.cb.b <= b;
|
||||
m_if.cb.bIsPos <= 1'b1;
|
||||
repeat(2) @(m_if.cb);
|
||||
`uvm_info(get_name(), $sformatf("%0d + %0d = %0d", a, b, m_if.cb.result), UVM_LOW);
|
||||
end
|
||||
`uvm_info(get_name(), "Ending test!", UVM_HIGH);
|
||||
phase.drop_objection(this);
|
||||
endtask: run_phase
|
||||
endclass
|
||||
|
||||
|
||||
module top;
|
||||
|
||||
bit clk;
|
||||
env environment;
|
||||
ADDER dut(.clk (clk));
|
||||
|
||||
initial begin
|
||||
environment = new("testbench_env");
|
||||
uvm_resource_db#(virtual adder_if)::set("env", "adder_if", dut.my_adder_if);
|
||||
clk = 0;
|
||||
run_test();
|
||||
end
|
||||
|
||||
// Clock generation
|
||||
initial begin
|
||||
forever begin
|
||||
#(1) clk = ~clk;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,205 @@
|
||||
The `crowdsale.vy` file has been added from
|
||||
[](https://github.com/binodnp/vyper-crowdsale/blob/master/contracts/crowdsale.v.py)
|
||||
under the following license:
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,89 @@
|
||||
# IndividuallyCappedCrowdsale
|
||||
# Contributors: Binod Nirvan
|
||||
# This file is released under Apache 2.0 license.
|
||||
# @dev Crowdsale with a limit for total contributions.
|
||||
# Ported from Open Zeppelin
|
||||
# https://github.com/OpenZeppelin
|
||||
#
|
||||
# See https://github.com/OpenZeppelin
|
||||
# Open Zeppelin tests ported: Crowdsale.test.js
|
||||
|
||||
|
||||
#@dev ERC20/223 Features referenced by this contract
|
||||
contract TokenContract:
|
||||
def transfer(_to: address, _value: uint256) -> bool: modifying
|
||||
|
||||
# Event for token purchase logging
|
||||
# @param _purchaser who paid for the tokens
|
||||
# @param _beneficiary who got the tokens
|
||||
# @param _value weis paid for purchase
|
||||
# @param _amount amount of tokens purchased
|
||||
TokenPurchase: event({_purchaser: indexed(address), _beneficiary: indexed(address), _value: uint256(wei), _amount: uint256})
|
||||
|
||||
# The token being sold
|
||||
token: public(address)
|
||||
|
||||
#Address where funds are collected
|
||||
wallet: public(address)
|
||||
|
||||
# How many token units a buyer gets per wei.
|
||||
# The rate is the conversion between wei and the smallest and indivisible token unit.
|
||||
# So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
|
||||
# 1 wei will give you 1 unit, or 0.001 TOK.
|
||||
rate: public(uint256)
|
||||
|
||||
#Amount of wei raised
|
||||
weiRaised: public(uint256(wei))
|
||||
|
||||
@public
|
||||
def __init__(_rate: uint256, _wallet: address, _token: address):
|
||||
"""
|
||||
@dev Initializes this contract
|
||||
@param _rate Number of token units a buyer gets per wei
|
||||
@param _wallet Address where collected funds will be forwarded to
|
||||
@param _token Address of the token being sold
|
||||
"""
|
||||
|
||||
assert _rate > 0, "Invalid value supplied for the parameter \"_rate\"."
|
||||
assert _wallet != ZERO_ADDRESS, "Invalid wallet address."
|
||||
assert _token != ZERO_ADDRESS, "Invalid token address."
|
||||
|
||||
self.rate = _rate
|
||||
self.wallet = _wallet
|
||||
self.token = _token
|
||||
|
||||
@private
|
||||
@constant
|
||||
def getTokenAmount(_weiAmount: uint256) -> uint256:
|
||||
return _weiAmount * self.rate
|
||||
|
||||
|
||||
@private
|
||||
def processTransaction(_sender: address, _beneficiary: address, _weiAmount: uint256(wei)):
|
||||
#pre validate
|
||||
assert _beneficiary != ZERO_ADDRESS, "Invalid address."
|
||||
assert _weiAmount != 0, "Invalid amount received."
|
||||
|
||||
#calculate the number of tokens for the Ether contribution.
|
||||
tokens: uint256 = self.getTokenAmount(as_unitless_number(_weiAmount))
|
||||
|
||||
self.weiRaised += _weiAmount
|
||||
|
||||
#process purchase
|
||||
assert TokenContract(self.token).transfer(_beneficiary, tokens), "Could not forward funds due to an unknown error."
|
||||
log.TokenPurchase(_sender, _beneficiary, _weiAmount, tokens)
|
||||
|
||||
#forward funds to the receiving wallet address.
|
||||
send(self.wallet, _weiAmount)
|
||||
|
||||
#post validate
|
||||
|
||||
@public
|
||||
@payable
|
||||
def buyTokens(_beneficiary: address):
|
||||
self.processTransaction(msg.sender, _beneficiary, msg.value)
|
||||
|
||||
@public
|
||||
@payable
|
||||
def __default__():
|
||||
self.processTransaction(msg.sender, msg.sender, msg.value)
|
||||
Reference in New Issue
Block a user