1
0

erc721.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. export const ERC721_ABI = [
  2. {
  3. "inputs": [
  4. {
  5. "internalType": "address",
  6. "name": "_aiusToken",
  7. "type": "address"
  8. },
  9. {
  10. "internalType": "address",
  11. "name": "_uniswapFactory",
  12. "type": "address"
  13. },
  14. {
  15. "internalType": "address",
  16. "name": "_uniswapRouter",
  17. "type": "address"
  18. },
  19. {
  20. "internalType": "address",
  21. "name": "_daoAddress",
  22. "type": "address"
  23. },
  24. {
  25. "internalType": "address",
  26. "name": "_erc20Implementation",
  27. "type": "address"
  28. }
  29. ],
  30. "stateMutability": "nonpayable",
  31. "type": "constructor"
  32. },
  33. {
  34. "inputs": [
  35. {
  36. "internalType": "address",
  37. "name": "sender",
  38. "type": "address"
  39. },
  40. {
  41. "internalType": "uint256",
  42. "name": "tokenId",
  43. "type": "uint256"
  44. },
  45. {
  46. "internalType": "address",
  47. "name": "owner",
  48. "type": "address"
  49. }
  50. ],
  51. "name": "ERC721IncorrectOwner",
  52. "type": "error"
  53. },
  54. {
  55. "inputs": [
  56. {
  57. "internalType": "address",
  58. "name": "operator",
  59. "type": "address"
  60. },
  61. {
  62. "internalType": "uint256",
  63. "name": "tokenId",
  64. "type": "uint256"
  65. }
  66. ],
  67. "name": "ERC721InsufficientApproval",
  68. "type": "error"
  69. },
  70. {
  71. "inputs": [
  72. {
  73. "internalType": "address",
  74. "name": "approver",
  75. "type": "address"
  76. }
  77. ],
  78. "name": "ERC721InvalidApprover",
  79. "type": "error"
  80. },
  81. {
  82. "inputs": [
  83. {
  84. "internalType": "address",
  85. "name": "operator",
  86. "type": "address"
  87. }
  88. ],
  89. "name": "ERC721InvalidOperator",
  90. "type": "error"
  91. },
  92. {
  93. "inputs": [
  94. {
  95. "internalType": "address",
  96. "name": "owner",
  97. "type": "address"
  98. }
  99. ],
  100. "name": "ERC721InvalidOwner",
  101. "type": "error"
  102. },
  103. {
  104. "inputs": [
  105. {
  106. "internalType": "address",
  107. "name": "receiver",
  108. "type": "address"
  109. }
  110. ],
  111. "name": "ERC721InvalidReceiver",
  112. "type": "error"
  113. },
  114. {
  115. "inputs": [
  116. {
  117. "internalType": "address",
  118. "name": "sender",
  119. "type": "address"
  120. }
  121. ],
  122. "name": "ERC721InvalidSender",
  123. "type": "error"
  124. },
  125. {
  126. "inputs": [
  127. {
  128. "internalType": "uint256",
  129. "name": "tokenId",
  130. "type": "uint256"
  131. }
  132. ],
  133. "name": "ERC721NonexistentToken",
  134. "type": "error"
  135. },
  136. {
  137. "inputs": [],
  138. "name": "FailedDeployment",
  139. "type": "error"
  140. },
  141. {
  142. "inputs": [
  143. {
  144. "internalType": "uint256",
  145. "name": "balance",
  146. "type": "uint256"
  147. },
  148. {
  149. "internalType": "uint256",
  150. "name": "needed",
  151. "type": "uint256"
  152. }
  153. ],
  154. "name": "InsufficientBalance",
  155. "type": "error"
  156. },
  157. {
  158. "inputs": [
  159. {
  160. "internalType": "uint256",
  161. "name": "value",
  162. "type": "uint256"
  163. },
  164. {
  165. "internalType": "uint256",
  166. "name": "length",
  167. "type": "uint256"
  168. }
  169. ],
  170. "name": "StringsInsufficientHexLength",
  171. "type": "error"
  172. },
  173. {
  174. "anonymous": false,
  175. "inputs": [
  176. {
  177. "indexed": true,
  178. "internalType": "address",
  179. "name": "owner",
  180. "type": "address"
  181. },
  182. {
  183. "indexed": true,
  184. "internalType": "address",
  185. "name": "approved",
  186. "type": "address"
  187. },
  188. {
  189. "indexed": true,
  190. "internalType": "uint256",
  191. "name": "tokenId",
  192. "type": "uint256"
  193. }
  194. ],
  195. "name": "Approval",
  196. "type": "event"
  197. },
  198. {
  199. "anonymous": false,
  200. "inputs": [
  201. {
  202. "indexed": true,
  203. "internalType": "address",
  204. "name": "owner",
  205. "type": "address"
  206. },
  207. {
  208. "indexed": true,
  209. "internalType": "address",
  210. "name": "operator",
  211. "type": "address"
  212. },
  213. {
  214. "indexed": false,
  215. "internalType": "bool",
  216. "name": "approved",
  217. "type": "bool"
  218. }
  219. ],
  220. "name": "ApprovalForAll",
  221. "type": "event"
  222. },
  223. {
  224. "anonymous": false,
  225. "inputs": [
  226. {
  227. "indexed": true,
  228. "internalType": "uint256",
  229. "name": "tokenId",
  230. "type": "uint256"
  231. },
  232. {
  233. "indexed": true,
  234. "internalType": "address",
  235. "name": "erc20Address",
  236. "type": "address"
  237. }
  238. ],
  239. "name": "ERC20Created",
  240. "type": "event"
  241. },
  242. {
  243. "anonymous": false,
  244. "inputs": [
  245. {
  246. "indexed": true,
  247. "internalType": "uint256",
  248. "name": "tokenId",
  249. "type": "uint256"
  250. }
  251. ],
  252. "name": "MetadataUpdated",
  253. "type": "event"
  254. },
  255. {
  256. "anonymous": false,
  257. "inputs": [
  258. {
  259. "indexed": true,
  260. "internalType": "uint256",
  261. "name": "tokenId",
  262. "type": "uint256"
  263. },
  264. {
  265. "indexed": true,
  266. "internalType": "address",
  267. "name": "pairAddress",
  268. "type": "address"
  269. }
  270. ],
  271. "name": "PairCreated",
  272. "type": "event"
  273. },
  274. {
  275. "anonymous": false,
  276. "inputs": [
  277. {
  278. "indexed": true,
  279. "internalType": "uint256",
  280. "name": "tokenId",
  281. "type": "uint256"
  282. },
  283. {
  284. "indexed": false,
  285. "internalType": "uint256",
  286. "name": "amount",
  287. "type": "uint256"
  288. }
  289. ],
  290. "name": "TokensReserved",
  291. "type": "event"
  292. },
  293. {
  294. "anonymous": false,
  295. "inputs": [
  296. {
  297. "indexed": true,
  298. "internalType": "uint256",
  299. "name": "tokenId",
  300. "type": "uint256"
  301. },
  302. {
  303. "indexed": true,
  304. "internalType": "address",
  305. "name": "who",
  306. "type": "address"
  307. },
  308. {
  309. "indexed": false,
  310. "internalType": "uint256",
  311. "name": "amount",
  312. "type": "uint256"
  313. }
  314. ],
  315. "name": "TokensWithdrawn",
  316. "type": "event"
  317. },
  318. {
  319. "anonymous": false,
  320. "inputs": [
  321. {
  322. "indexed": true,
  323. "internalType": "address",
  324. "name": "from",
  325. "type": "address"
  326. },
  327. {
  328. "indexed": true,
  329. "internalType": "address",
  330. "name": "to",
  331. "type": "address"
  332. },
  333. {
  334. "indexed": true,
  335. "internalType": "uint256",
  336. "name": "tokenId",
  337. "type": "uint256"
  338. }
  339. ],
  340. "name": "Transfer",
  341. "type": "event"
  342. },
  343. {
  344. "inputs": [],
  345. "name": "aiusToken",
  346. "outputs": [
  347. {
  348. "internalType": "contract IERC20",
  349. "name": "",
  350. "type": "address"
  351. }
  352. ],
  353. "stateMutability": "view",
  354. "type": "function"
  355. },
  356. {
  357. "inputs": [
  358. {
  359. "internalType": "address",
  360. "name": "to",
  361. "type": "address"
  362. },
  363. {
  364. "internalType": "uint256",
  365. "name": "tokenId",
  366. "type": "uint256"
  367. }
  368. ],
  369. "name": "approve",
  370. "outputs": [],
  371. "stateMutability": "nonpayable",
  372. "type": "function"
  373. },
  374. {
  375. "inputs": [
  376. {
  377. "internalType": "address",
  378. "name": "owner",
  379. "type": "address"
  380. }
  381. ],
  382. "name": "balanceOf",
  383. "outputs": [
  384. {
  385. "internalType": "uint256",
  386. "name": "",
  387. "type": "uint256"
  388. }
  389. ],
  390. "stateMutability": "view",
  391. "type": "function"
  392. },
  393. {
  394. "inputs": [],
  395. "name": "daoAddress",
  396. "outputs": [
  397. {
  398. "internalType": "address",
  399. "name": "",
  400. "type": "address"
  401. }
  402. ],
  403. "stateMutability": "view",
  404. "type": "function"
  405. },
  406. {
  407. "inputs": [],
  408. "name": "erc20Implementation",
  409. "outputs": [
  410. {
  411. "internalType": "address",
  412. "name": "",
  413. "type": "address"
  414. }
  415. ],
  416. "stateMutability": "view",
  417. "type": "function"
  418. },
  419. {
  420. "inputs": [
  421. {
  422. "internalType": "uint256",
  423. "name": "tokenId",
  424. "type": "uint256"
  425. },
  426. {
  427. "internalType": "address",
  428. "name": "addr",
  429. "type": "address"
  430. }
  431. ],
  432. "name": "getAiusAndOwed",
  433. "outputs": [
  434. {
  435. "internalType": "uint256",
  436. "name": "aius",
  437. "type": "uint256"
  438. },
  439. {
  440. "internalType": "uint256",
  441. "name": "owed",
  442. "type": "uint256"
  443. }
  444. ],
  445. "stateMutability": "view",
  446. "type": "function"
  447. },
  448. {
  449. "inputs": [
  450. {
  451. "internalType": "uint256",
  452. "name": "tokenId",
  453. "type": "uint256"
  454. }
  455. ],
  456. "name": "getApproved",
  457. "outputs": [
  458. {
  459. "internalType": "address",
  460. "name": "",
  461. "type": "address"
  462. }
  463. ],
  464. "stateMutability": "view",
  465. "type": "function"
  466. },
  467. {
  468. "inputs": [
  469. {
  470. "internalType": "uint256",
  471. "name": "tokenId",
  472. "type": "uint256"
  473. },
  474. {
  475. "internalType": "string[]",
  476. "name": "keys",
  477. "type": "string[]"
  478. }
  479. ],
  480. "name": "getMetadata",
  481. "outputs": [
  482. {
  483. "internalType": "string[]",
  484. "name": "",
  485. "type": "string[]"
  486. }
  487. ],
  488. "stateMutability": "view",
  489. "type": "function"
  490. },
  491. {
  492. "inputs": [
  493. {
  494. "internalType": "uint256",
  495. "name": "tokenId",
  496. "type": "uint256"
  497. }
  498. ],
  499. "name": "getTokenData",
  500. "outputs": [
  501. {
  502. "internalType": "address",
  503. "name": "erc20Token",
  504. "type": "address"
  505. },
  506. {
  507. "internalType": "uint256",
  508. "name": "totalSupply",
  509. "type": "uint256"
  510. },
  511. {
  512. "internalType": "uint112",
  513. "name": "reserve0",
  514. "type": "uint112"
  515. },
  516. {
  517. "internalType": "uint112",
  518. "name": "reserve1",
  519. "type": "uint112"
  520. },
  521. {
  522. "internalType": "address",
  523. "name": "pairAddress",
  524. "type": "address"
  525. }
  526. ],
  527. "stateMutability": "view",
  528. "type": "function"
  529. },
  530. {
  531. "inputs": [
  532. {
  533. "internalType": "address",
  534. "name": "owner",
  535. "type": "address"
  536. },
  537. {
  538. "internalType": "address",
  539. "name": "operator",
  540. "type": "address"
  541. }
  542. ],
  543. "name": "isApprovedForAll",
  544. "outputs": [
  545. {
  546. "internalType": "bool",
  547. "name": "",
  548. "type": "bool"
  549. }
  550. ],
  551. "stateMutability": "view",
  552. "type": "function"
  553. },
  554. {
  555. "inputs": [
  556. {
  557. "internalType": "string",
  558. "name": "name",
  559. "type": "string"
  560. },
  561. {
  562. "internalType": "string",
  563. "name": "symbol",
  564. "type": "string"
  565. },
  566. {
  567. "internalType": "string[]",
  568. "name": "keys",
  569. "type": "string[]"
  570. },
  571. {
  572. "internalType": "string[]",
  573. "name": "values",
  574. "type": "string[]"
  575. }
  576. ],
  577. "name": "mint",
  578. "outputs": [],
  579. "stateMutability": "nonpayable",
  580. "type": "function"
  581. },
  582. {
  583. "inputs": [],
  584. "name": "name",
  585. "outputs": [
  586. {
  587. "internalType": "string",
  588. "name": "",
  589. "type": "string"
  590. }
  591. ],
  592. "stateMutability": "view",
  593. "type": "function"
  594. },
  595. {
  596. "inputs": [
  597. {
  598. "internalType": "uint256",
  599. "name": "tokenId",
  600. "type": "uint256"
  601. }
  602. ],
  603. "name": "ownerOf",
  604. "outputs": [
  605. {
  606. "internalType": "address",
  607. "name": "",
  608. "type": "address"
  609. }
  610. ],
  611. "stateMutability": "view",
  612. "type": "function"
  613. },
  614. {
  615. "inputs": [
  616. {
  617. "internalType": "uint256",
  618. "name": "tokenId",
  619. "type": "uint256"
  620. },
  621. {
  622. "internalType": "uint256",
  623. "name": "amount",
  624. "type": "uint256"
  625. }
  626. ],
  627. "name": "reserveTokens",
  628. "outputs": [],
  629. "stateMutability": "nonpayable",
  630. "type": "function"
  631. },
  632. {
  633. "inputs": [
  634. {
  635. "internalType": "address",
  636. "name": "from",
  637. "type": "address"
  638. },
  639. {
  640. "internalType": "address",
  641. "name": "to",
  642. "type": "address"
  643. },
  644. {
  645. "internalType": "uint256",
  646. "name": "tokenId",
  647. "type": "uint256"
  648. }
  649. ],
  650. "name": "safeTransferFrom",
  651. "outputs": [],
  652. "stateMutability": "nonpayable",
  653. "type": "function"
  654. },
  655. {
  656. "inputs": [
  657. {
  658. "internalType": "address",
  659. "name": "from",
  660. "type": "address"
  661. },
  662. {
  663. "internalType": "address",
  664. "name": "to",
  665. "type": "address"
  666. },
  667. {
  668. "internalType": "uint256",
  669. "name": "tokenId",
  670. "type": "uint256"
  671. },
  672. {
  673. "internalType": "bytes",
  674. "name": "data",
  675. "type": "bytes"
  676. }
  677. ],
  678. "name": "safeTransferFrom",
  679. "outputs": [],
  680. "stateMutability": "nonpayable",
  681. "type": "function"
  682. },
  683. {
  684. "inputs": [
  685. {
  686. "internalType": "address",
  687. "name": "operator",
  688. "type": "address"
  689. },
  690. {
  691. "internalType": "bool",
  692. "name": "approved",
  693. "type": "bool"
  694. }
  695. ],
  696. "name": "setApprovalForAll",
  697. "outputs": [],
  698. "stateMutability": "nonpayable",
  699. "type": "function"
  700. },
  701. {
  702. "inputs": [
  703. {
  704. "internalType": "uint256",
  705. "name": "tokenId",
  706. "type": "uint256"
  707. },
  708. {
  709. "internalType": "string[]",
  710. "name": "keys",
  711. "type": "string[]"
  712. },
  713. {
  714. "internalType": "string[]",
  715. "name": "values",
  716. "type": "string[]"
  717. }
  718. ],
  719. "name": "setMetadata",
  720. "outputs": [],
  721. "stateMutability": "nonpayable",
  722. "type": "function"
  723. },
  724. {
  725. "inputs": [
  726. {
  727. "internalType": "bytes4",
  728. "name": "interfaceId",
  729. "type": "bytes4"
  730. }
  731. ],
  732. "name": "supportsInterface",
  733. "outputs": [
  734. {
  735. "internalType": "bool",
  736. "name": "",
  737. "type": "bool"
  738. }
  739. ],
  740. "stateMutability": "view",
  741. "type": "function"
  742. },
  743. {
  744. "inputs": [],
  745. "name": "symbol",
  746. "outputs": [
  747. {
  748. "internalType": "string",
  749. "name": "",
  750. "type": "string"
  751. }
  752. ],
  753. "stateMutability": "view",
  754. "type": "function"
  755. },
  756. {
  757. "inputs": [],
  758. "name": "tokenIdCounter",
  759. "outputs": [
  760. {
  761. "internalType": "uint256",
  762. "name": "",
  763. "type": "uint256"
  764. }
  765. ],
  766. "stateMutability": "view",
  767. "type": "function"
  768. },
  769. {
  770. "inputs": [
  771. {
  772. "internalType": "uint256",
  773. "name": "tokenId",
  774. "type": "uint256"
  775. }
  776. ],
  777. "name": "tokenURI",
  778. "outputs": [
  779. {
  780. "internalType": "string",
  781. "name": "",
  782. "type": "string"
  783. }
  784. ],
  785. "stateMutability": "view",
  786. "type": "function"
  787. },
  788. {
  789. "inputs": [
  790. {
  791. "internalType": "address",
  792. "name": "from",
  793. "type": "address"
  794. },
  795. {
  796. "internalType": "address",
  797. "name": "to",
  798. "type": "address"
  799. },
  800. {
  801. "internalType": "uint256",
  802. "name": "tokenId",
  803. "type": "uint256"
  804. }
  805. ],
  806. "name": "transferFrom",
  807. "outputs": [],
  808. "stateMutability": "nonpayable",
  809. "type": "function"
  810. },
  811. {
  812. "inputs": [],
  813. "name": "uniswapFactory",
  814. "outputs": [
  815. {
  816. "internalType": "contract IUniswapV2Factory",
  817. "name": "",
  818. "type": "address"
  819. }
  820. ],
  821. "stateMutability": "view",
  822. "type": "function"
  823. },
  824. {
  825. "inputs": [],
  826. "name": "uniswapRouter",
  827. "outputs": [
  828. {
  829. "internalType": "contract IUniswapV2Router",
  830. "name": "",
  831. "type": "address"
  832. }
  833. ],
  834. "stateMutability": "view",
  835. "type": "function"
  836. },
  837. {
  838. "inputs": [
  839. {
  840. "internalType": "uint256",
  841. "name": "tokenId",
  842. "type": "uint256"
  843. },
  844. {
  845. "internalType": "address",
  846. "name": "addr",
  847. "type": "address"
  848. }
  849. ],
  850. "name": "withdrawTokens",
  851. "outputs": [],
  852. "stateMutability": "nonpayable",
  853. "type": "function"
  854. }
  855. ];