updated with more deployments and tests
2446d8a9
11 file(s) · +498 −141
| 47 | 47 | _safeMint(to, tokenId); |
|
| 48 | 48 | _setTokenURI(tokenId, uri); |
|
| 49 | 49 | setHealth(tokenId, 10); |
|
| 50 | - | tokenLocation[tokenId] = Location.Home; |
|
| 50 | + | tokenLocation[tokenId] = Location.Bar; |
|
| 51 | 51 | } |
|
| 52 | 52 | ||
| 53 | 53 | // Function to get health of a token |
| 31 | 31 | } |
|
| 32 | 32 | ||
| 33 | 33 | function mint(address to, uint256 amount) public onlyOwner { |
|
| 34 | - | _mint(to, amount); |
|
| 34 | + | uint256 mintAmount = amount * (10 ** decimals()); |
|
| 35 | + | _mint(to, mintAmount); |
|
| 35 | 36 | } |
|
| 36 | 37 | ||
| 37 | 38 | // The following functions are overrides required by Solidity. |
| 49 | 49 | jupiterJunk.mint(to, suppliesAmount); |
|
| 50 | 50 | } |
|
| 51 | 51 | ||
| 52 | + | function getNPCStats( |
|
| 53 | + | uint256 tokenId |
|
| 54 | + | ) external view returns (uint8, string memory) { |
|
| 55 | + | uint8 health = cosmicCowboys.getHealth(tokenId); |
|
| 56 | + | string memory location = cosmicCowboys.getCurrentLocation(tokenId); |
|
| 57 | + | return (health, location); |
|
| 58 | + | } |
|
| 59 | + | ||
| 52 | 60 | function getOwner() external view returns (address) { |
|
| 53 | 61 | return owner(); |
|
| 54 | 62 | } |
| 14 | 14 | accounts: |
|
| 15 | 15 | process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], |
|
| 16 | 16 | }, |
|
| 17 | + | baseGoerli: { |
|
| 18 | + | url: `${process.env.ALCHEMY_URL_BASE}`, |
|
| 19 | + | accounts: [process.env.PRIVATE_KEY] |
|
| 20 | + | } |
|
| 21 | + | }, |
|
| 22 | + | etherscan: { |
|
| 23 | + | apiKey: process.env.ETHERSCAN_API_KEY |
|
| 17 | 24 | } |
|
| 18 | 25 | ||
| 19 | 26 | }; |
| 7 | 7 | "name": "hardhat-project", |
|
| 8 | 8 | "dependencies": { |
|
| 9 | 9 | "@openzeppelin/contracts": "^5.0.0", |
|
| 10 | + | "@tokenbound/sdk": "^0.3.9", |
|
| 10 | 11 | "dotenv": "^16.3.1", |
|
| 11 | 12 | "ethers": "^6.7.1" |
|
| 12 | 13 | }, |
|
| 13 | 14 | "devDependencies": { |
|
| 14 | 15 | "@nomicfoundation/hardhat-toolbox": "^3.0.0", |
|
| 16 | + | "@nomiclabs/hardhat-etherscan": "^3.1.7", |
|
| 15 | 17 | "hardhat": "^2.18.0", |
|
| 16 | 18 | "mocha": "^10.2.0" |
|
| 17 | 19 | } |
|
| 18 | 20 | }, |
|
| 19 | 21 | "node_modules/@adraffy/ens-normalize": { |
|
| 20 | - | "version": "1.9.2", |
|
| 21 | - | "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", |
|
| 22 | - | "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" |
|
| 22 | + | "version": "1.10.0", |
|
| 23 | + | "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", |
|
| 24 | + | "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" |
|
| 23 | 25 | }, |
|
| 24 | 26 | "node_modules/@chainsafe/as-sha256": { |
|
| 25 | 27 | "version": "0.3.1", |
|
| 425 | 427 | "aes-js": "3.0.0", |
|
| 426 | 428 | "scrypt-js": "3.0.1" |
|
| 427 | 429 | } |
|
| 428 | - | }, |
|
| 429 | - | "node_modules/@ethersproject/json-wallets/node_modules/aes-js": { |
|
| 430 | - | "version": "3.0.0", |
|
| 431 | - | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", |
|
| 432 | - | "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", |
|
| 433 | - | "dev": true |
|
| 434 | 430 | }, |
|
| 435 | 431 | "node_modules/@ethersproject/keccak256": { |
|
| 436 | 432 | "version": "5.7.0", |
|
| 952 | 948 | } |
|
| 953 | 949 | }, |
|
| 954 | 950 | "node_modules/@noble/hashes": { |
|
| 955 | - | "version": "1.1.2", |
|
| 956 | - | "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", |
|
| 957 | - | "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", |
|
| 958 | - | "funding": [ |
|
| 959 | - | { |
|
| 960 | - | "type": "individual", |
|
| 961 | - | "url": "https://paulmillr.com/funding/" |
|
| 962 | - | } |
|
| 963 | - | ] |
|
| 951 | + | "version": "1.3.2", |
|
| 952 | + | "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", |
|
| 953 | + | "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", |
|
| 954 | + | "engines": { |
|
| 955 | + | "node": ">= 16" |
|
| 956 | + | }, |
|
| 957 | + | "funding": { |
|
| 958 | + | "url": "https://paulmillr.com/funding/" |
|
| 959 | + | } |
|
| 964 | 960 | }, |
|
| 965 | 961 | "node_modules/@noble/secp256k1": { |
|
| 966 | 962 | "version": "1.7.1", |
|
| 967 | 963 | "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", |
|
| 968 | 964 | "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", |
|
| 965 | + | "dev": true, |
|
| 969 | 966 | "funding": [ |
|
| 970 | 967 | { |
|
| 971 | 968 | "type": "individual", |
|
| 1585 | 1582 | "node": ">= 10" |
|
| 1586 | 1583 | } |
|
| 1587 | 1584 | }, |
|
| 1585 | + | "node_modules/@nomiclabs/hardhat-etherscan": { |
|
| 1586 | + | "version": "3.1.7", |
|
| 1587 | + | "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-etherscan/-/hardhat-etherscan-3.1.7.tgz", |
|
| 1588 | + | "integrity": "sha512-tZ3TvSgpvsQ6B6OGmo1/Au6u8BrAkvs1mIC/eURA3xgIfznUZBhmpne8hv7BXUzw9xNL3fXdpOYgOQlVMTcoHQ==", |
|
| 1589 | + | "dev": true, |
|
| 1590 | + | "dependencies": { |
|
| 1591 | + | "@ethersproject/abi": "^5.1.2", |
|
| 1592 | + | "@ethersproject/address": "^5.0.2", |
|
| 1593 | + | "cbor": "^8.1.0", |
|
| 1594 | + | "chalk": "^2.4.2", |
|
| 1595 | + | "debug": "^4.1.1", |
|
| 1596 | + | "fs-extra": "^7.0.1", |
|
| 1597 | + | "lodash": "^4.17.11", |
|
| 1598 | + | "semver": "^6.3.0", |
|
| 1599 | + | "table": "^6.8.0", |
|
| 1600 | + | "undici": "^5.14.0" |
|
| 1601 | + | }, |
|
| 1602 | + | "peerDependencies": { |
|
| 1603 | + | "hardhat": "^2.0.4" |
|
| 1604 | + | } |
|
| 1605 | + | }, |
|
| 1606 | + | "node_modules/@nomiclabs/hardhat-etherscan/node_modules/fs-extra": { |
|
| 1607 | + | "version": "7.0.1", |
|
| 1608 | + | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", |
|
| 1609 | + | "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", |
|
| 1610 | + | "dev": true, |
|
| 1611 | + | "dependencies": { |
|
| 1612 | + | "graceful-fs": "^4.1.2", |
|
| 1613 | + | "jsonfile": "^4.0.0", |
|
| 1614 | + | "universalify": "^0.1.0" |
|
| 1615 | + | }, |
|
| 1616 | + | "engines": { |
|
| 1617 | + | "node": ">=6 <7 || >=8" |
|
| 1618 | + | } |
|
| 1619 | + | }, |
|
| 1620 | + | "node_modules/@nomiclabs/hardhat-etherscan/node_modules/jsonfile": { |
|
| 1621 | + | "version": "4.0.0", |
|
| 1622 | + | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", |
|
| 1623 | + | "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", |
|
| 1624 | + | "dev": true, |
|
| 1625 | + | "optionalDependencies": { |
|
| 1626 | + | "graceful-fs": "^4.1.6" |
|
| 1627 | + | } |
|
| 1628 | + | }, |
|
| 1629 | + | "node_modules/@nomiclabs/hardhat-etherscan/node_modules/universalify": { |
|
| 1630 | + | "version": "0.1.2", |
|
| 1631 | + | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", |
|
| 1632 | + | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", |
|
| 1633 | + | "dev": true, |
|
| 1634 | + | "engines": { |
|
| 1635 | + | "node": ">= 4.0.0" |
|
| 1636 | + | } |
|
| 1637 | + | }, |
|
| 1588 | 1638 | "node_modules/@openzeppelin/contracts": { |
|
| 1589 | 1639 | "version": "5.0.0", |
|
| 1590 | 1640 | "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-5.0.0.tgz", |
|
| 1594 | 1644 | "version": "1.1.3", |
|
| 1595 | 1645 | "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz", |
|
| 1596 | 1646 | "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==", |
|
| 1597 | - | "dev": true, |
|
| 1598 | 1647 | "funding": { |
|
| 1599 | 1648 | "url": "https://paulmillr.com/funding/" |
|
| 1600 | 1649 | } |
|
| 1614 | 1663 | "url": "https://paulmillr.com/funding/" |
|
| 1615 | 1664 | } |
|
| 1616 | 1665 | }, |
|
| 1617 | - | "node_modules/@scure/bip32/node_modules/@noble/hashes": { |
|
| 1618 | - | "version": "1.3.2", |
|
| 1619 | - | "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", |
|
| 1620 | - | "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", |
|
| 1621 | - | "dev": true, |
|
| 1622 | - | "peer": true, |
|
| 1623 | - | "engines": { |
|
| 1624 | - | "node": ">= 16" |
|
| 1625 | - | }, |
|
| 1626 | - | "funding": { |
|
| 1627 | - | "url": "https://paulmillr.com/funding/" |
|
| 1628 | - | } |
|
| 1629 | - | }, |
|
| 1630 | 1666 | "node_modules/@scure/bip39": { |
|
| 1631 | 1667 | "version": "1.2.1", |
|
| 1632 | 1668 | "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", |
|
| 1633 | 1669 | "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", |
|
| 1634 | - | "dev": true, |
|
| 1635 | - | "peer": true, |
|
| 1636 | 1670 | "dependencies": { |
|
| 1637 | 1671 | "@noble/hashes": "~1.3.0", |
|
| 1638 | 1672 | "@scure/base": "~1.1.0" |
|
| 1641 | 1675 | "url": "https://paulmillr.com/funding/" |
|
| 1642 | 1676 | } |
|
| 1643 | 1677 | }, |
|
| 1644 | - | "node_modules/@scure/bip39/node_modules/@noble/hashes": { |
|
| 1645 | - | "version": "1.3.2", |
|
| 1646 | - | "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", |
|
| 1647 | - | "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", |
|
| 1648 | - | "dev": true, |
|
| 1649 | - | "peer": true, |
|
| 1650 | - | "engines": { |
|
| 1651 | - | "node": ">= 16" |
|
| 1652 | - | }, |
|
| 1653 | - | "funding": { |
|
| 1654 | - | "url": "https://paulmillr.com/funding/" |
|
| 1655 | - | } |
|
| 1656 | - | }, |
|
| 1657 | 1678 | "node_modules/@sentry/core": { |
|
| 1658 | 1679 | "version": "5.30.0", |
|
| 1659 | 1680 | "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", |
|
| 1800 | 1821 | "peer": true, |
|
| 1801 | 1822 | "dependencies": { |
|
| 1802 | 1823 | "antlr4ts": "^0.5.0-alpha.4" |
|
| 1824 | + | } |
|
| 1825 | + | }, |
|
| 1826 | + | "node_modules/@tokenbound/sdk": { |
|
| 1827 | + | "version": "0.3.9", |
|
| 1828 | + | "resolved": "https://registry.npmjs.org/@tokenbound/sdk/-/sdk-0.3.9.tgz", |
|
| 1829 | + | "integrity": "sha512-Mldj/pmJDBtExJ88uhAPyetrZ1P4JZbmU10A4ZITt0yBRZKeTCUu2jOzVNWJErPDL3/kZGUlKYMkRqMhmOUibA==", |
|
| 1830 | + | "dependencies": { |
|
| 1831 | + | "viem": "^1.14.0" |
|
| 1803 | 1832 | } |
|
| 1804 | 1833 | }, |
|
| 1805 | 1834 | "node_modules/@tsconfig/node10": { |
|
| 2000 | 2029 | "dev": true, |
|
| 2001 | 2030 | "peer": true |
|
| 2002 | 2031 | }, |
|
| 2032 | + | "node_modules/abitype": { |
|
| 2033 | + | "version": "0.9.8", |
|
| 2034 | + | "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.9.8.tgz", |
|
| 2035 | + | "integrity": "sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==", |
|
| 2036 | + | "funding": [ |
|
| 2037 | + | { |
|
| 2038 | + | "type": "github", |
|
| 2039 | + | "url": "https://github.com/sponsors/wagmi-dev" |
|
| 2040 | + | } |
|
| 2041 | + | ], |
|
| 2042 | + | "peerDependencies": { |
|
| 2043 | + | "typescript": ">=5.0.4", |
|
| 2044 | + | "zod": "^3 >=3.19.1" |
|
| 2045 | + | }, |
|
| 2046 | + | "peerDependenciesMeta": { |
|
| 2047 | + | "typescript": { |
|
| 2048 | + | "optional": true |
|
| 2049 | + | }, |
|
| 2050 | + | "zod": { |
|
| 2051 | + | "optional": true |
|
| 2052 | + | } |
|
| 2053 | + | } |
|
| 2054 | + | }, |
|
| 2003 | 2055 | "node_modules/abstract-level": { |
|
| 2004 | 2056 | "version": "1.0.3", |
|
| 2005 | 2057 | "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", |
|
| 2061 | 2113 | } |
|
| 2062 | 2114 | }, |
|
| 2063 | 2115 | "node_modules/aes-js": { |
|
| 2064 | - | "version": "4.0.0-beta.5", |
|
| 2065 | - | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", |
|
| 2066 | - | "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" |
|
| 2116 | + | "version": "3.0.0", |
|
| 2117 | + | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", |
|
| 2118 | + | "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", |
|
| 2119 | + | "dev": true |
|
| 2067 | 2120 | }, |
|
| 2068 | 2121 | "node_modules/agent-base": { |
|
| 2069 | 2122 | "version": "6.0.2", |
|
| 2095 | 2148 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", |
|
| 2096 | 2149 | "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", |
|
| 2097 | 2150 | "dev": true, |
|
| 2098 | - | "peer": true, |
|
| 2099 | 2151 | "dependencies": { |
|
| 2100 | 2152 | "fast-deep-equal": "^3.1.1", |
|
| 2101 | 2153 | "json-schema-traverse": "^1.0.0", |
|
| 2248 | 2300 | "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", |
|
| 2249 | 2301 | "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", |
|
| 2250 | 2302 | "dev": true, |
|
| 2251 | - | "peer": true, |
|
| 2252 | 2303 | "engines": { |
|
| 2253 | 2304 | "node": ">=8" |
|
| 2254 | 2305 | } |
|
| 2541 | 2592 | "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", |
|
| 2542 | 2593 | "integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==", |
|
| 2543 | 2594 | "dev": true, |
|
| 2544 | - | "peer": true, |
|
| 2545 | 2595 | "dependencies": { |
|
| 2546 | 2596 | "nofilter": "^3.1.0" |
|
| 2547 | 2597 | }, |
|
| 3469 | 3519 | } |
|
| 3470 | 3520 | }, |
|
| 3471 | 3521 | "node_modules/ethers": { |
|
| 3472 | - | "version": "6.7.1", |
|
| 3473 | - | "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.7.1.tgz", |
|
| 3474 | - | "integrity": "sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA==", |
|
| 3522 | + | "version": "6.8.0", |
|
| 3523 | + | "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.8.0.tgz", |
|
| 3524 | + | "integrity": "sha512-zrFbmQRlraM+cU5mE4CZTLBurZTs2gdp2ld0nG/f3ecBK+x6lZ69KSxBqZ4NjclxwfTxl5LeNufcBbMsTdY53Q==", |
|
| 3475 | 3525 | "funding": [ |
|
| 3476 | 3526 | { |
|
| 3477 | 3527 | "type": "individual", |
|
| 3483 | 3533 | } |
|
| 3484 | 3534 | ], |
|
| 3485 | 3535 | "dependencies": { |
|
| 3486 | - | "@adraffy/ens-normalize": "1.9.2", |
|
| 3487 | - | "@noble/hashes": "1.1.2", |
|
| 3488 | - | "@noble/secp256k1": "1.7.1", |
|
| 3536 | + | "@adraffy/ens-normalize": "1.10.0", |
|
| 3537 | + | "@noble/curves": "1.2.0", |
|
| 3538 | + | "@noble/hashes": "1.3.2", |
|
| 3489 | 3539 | "@types/node": "18.15.13", |
|
| 3490 | 3540 | "aes-js": "4.0.0-beta.5", |
|
| 3491 | 3541 | "tslib": "2.4.0", |
|
| 3495 | 3545 | "node": ">=14.0.0" |
|
| 3496 | 3546 | } |
|
| 3497 | 3547 | }, |
|
| 3548 | + | "node_modules/ethers/node_modules/@noble/curves": { |
|
| 3549 | + | "version": "1.2.0", |
|
| 3550 | + | "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", |
|
| 3551 | + | "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", |
|
| 3552 | + | "dependencies": { |
|
| 3553 | + | "@noble/hashes": "1.3.2" |
|
| 3554 | + | }, |
|
| 3555 | + | "funding": { |
|
| 3556 | + | "url": "https://paulmillr.com/funding/" |
|
| 3557 | + | } |
|
| 3558 | + | }, |
|
| 3498 | 3559 | "node_modules/ethers/node_modules/@types/node": { |
|
| 3499 | 3560 | "version": "18.15.13", |
|
| 3500 | 3561 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", |
|
| 3501 | 3562 | "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" |
|
| 3563 | + | }, |
|
| 3564 | + | "node_modules/ethers/node_modules/aes-js": { |
|
| 3565 | + | "version": "4.0.0-beta.5", |
|
| 3566 | + | "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", |
|
| 3567 | + | "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" |
|
| 3502 | 3568 | }, |
|
| 3503 | 3569 | "node_modules/ethjs-unit": { |
|
| 3504 | 3570 | "version": "0.1.6", |
|
| 3550 | 3616 | "version": "3.1.3", |
|
| 3551 | 3617 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", |
|
| 3552 | 3618 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", |
|
| 3553 | - | "dev": true, |
|
| 3554 | - | "peer": true |
|
| 3619 | + | "dev": true |
|
| 3555 | 3620 | }, |
|
| 3556 | 3621 | "node_modules/fast-glob": { |
|
| 3557 | 3622 | "version": "3.3.1", |
|
| 4480 | 4545 | "dev": true, |
|
| 4481 | 4546 | "peer": true |
|
| 4482 | 4547 | }, |
|
| 4548 | + | "node_modules/isows": { |
|
| 4549 | + | "version": "1.0.3", |
|
| 4550 | + | "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", |
|
| 4551 | + | "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", |
|
| 4552 | + | "funding": [ |
|
| 4553 | + | { |
|
| 4554 | + | "type": "github", |
|
| 4555 | + | "url": "https://github.com/sponsors/wagmi-dev" |
|
| 4556 | + | } |
|
| 4557 | + | ], |
|
| 4558 | + | "peerDependencies": { |
|
| 4559 | + | "ws": "*" |
|
| 4560 | + | } |
|
| 4561 | + | }, |
|
| 4483 | 4562 | "node_modules/js-sdsl": { |
|
| 4484 | 4563 | "version": "4.4.2", |
|
| 4485 | 4564 | "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.2.tgz", |
|
| 4512 | 4591 | "version": "1.0.0", |
|
| 4513 | 4592 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", |
|
| 4514 | 4593 | "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", |
|
| 4515 | - | "dev": true, |
|
| 4516 | - | "peer": true |
|
| 4594 | + | "dev": true |
|
| 4517 | 4595 | }, |
|
| 4518 | 4596 | "node_modules/jsonfile": { |
|
| 4519 | 4597 | "version": "6.1.0", |
|
| 4669 | 4747 | "version": "4.4.2", |
|
| 4670 | 4748 | "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", |
|
| 4671 | 4749 | "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", |
|
| 4672 | - | "dev": true, |
|
| 4673 | - | "peer": true |
|
| 4750 | + | "dev": true |
|
| 4674 | 4751 | }, |
|
| 4675 | 4752 | "node_modules/log-symbols": { |
|
| 4676 | 4753 | "version": "4.1.0", |
|
| 5204 | 5281 | "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", |
|
| 5205 | 5282 | "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", |
|
| 5206 | 5283 | "dev": true, |
|
| 5207 | - | "peer": true, |
|
| 5208 | 5284 | "engines": { |
|
| 5209 | 5285 | "node": ">=12.19" |
|
| 5210 | 5286 | } |
|
| 5514 | 5590 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", |
|
| 5515 | 5591 | "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", |
|
| 5516 | 5592 | "dev": true, |
|
| 5517 | - | "peer": true, |
|
| 5518 | 5593 | "engines": { |
|
| 5519 | 5594 | "node": ">=6" |
|
| 5520 | 5595 | } |
|
| 6068 | 6143 | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", |
|
| 6069 | 6144 | "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", |
|
| 6070 | 6145 | "dev": true, |
|
| 6071 | - | "peer": true, |
|
| 6072 | 6146 | "dependencies": { |
|
| 6073 | 6147 | "ansi-styles": "^4.0.0", |
|
| 6074 | 6148 | "astral-regex": "^2.0.0", |
|
| 6086 | 6160 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", |
|
| 6087 | 6161 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", |
|
| 6088 | 6162 | "dev": true, |
|
| 6089 | - | "peer": true, |
|
| 6090 | 6163 | "dependencies": { |
|
| 6091 | 6164 | "color-convert": "^2.0.1" |
|
| 6092 | 6165 | }, |
|
| 6102 | 6175 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", |
|
| 6103 | 6176 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", |
|
| 6104 | 6177 | "dev": true, |
|
| 6105 | - | "peer": true, |
|
| 6106 | 6178 | "dependencies": { |
|
| 6107 | 6179 | "color-name": "~1.1.4" |
|
| 6108 | 6180 | }, |
|
| 6114 | 6186 | "version": "1.1.4", |
|
| 6115 | 6187 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", |
|
| 6116 | 6188 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
|
| 6117 | - | "dev": true, |
|
| 6118 | - | "peer": true |
|
| 6189 | + | "dev": true |
|
| 6119 | 6190 | }, |
|
| 6120 | 6191 | "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { |
|
| 6121 | 6192 | "version": "3.0.0", |
|
| 6122 | 6193 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", |
|
| 6123 | 6194 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", |
|
| 6124 | 6195 | "dev": true, |
|
| 6125 | - | "peer": true, |
|
| 6126 | 6196 | "engines": { |
|
| 6127 | 6197 | "node": ">=8" |
|
| 6128 | 6198 | } |
|
| 6499 | 6569 | "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", |
|
| 6500 | 6570 | "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", |
|
| 6501 | 6571 | "dev": true, |
|
| 6502 | - | "peer": true, |
|
| 6503 | 6572 | "dependencies": { |
|
| 6504 | 6573 | "ajv": "^8.0.1", |
|
| 6505 | 6574 | "lodash.truncate": "^4.4.2", |
|
| 6552 | 6621 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", |
|
| 6553 | 6622 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", |
|
| 6554 | 6623 | "dev": true, |
|
| 6555 | - | "peer": true, |
|
| 6556 | 6624 | "engines": { |
|
| 6557 | 6625 | "node": ">=8" |
|
| 6558 | 6626 | } |
|
| 6562 | 6630 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", |
|
| 6563 | 6631 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", |
|
| 6564 | 6632 | "dev": true, |
|
| 6565 | - | "peer": true, |
|
| 6566 | 6633 | "dependencies": { |
|
| 6567 | 6634 | "emoji-regex": "^8.0.0", |
|
| 6568 | 6635 | "is-fullwidth-code-point": "^3.0.0", |
|
| 6969 | 7036 | "version": "5.2.2", |
|
| 6970 | 7037 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", |
|
| 6971 | 7038 | "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", |
|
| 6972 | - | "dev": true, |
|
| 7039 | + | "devOptional": true, |
|
| 6973 | 7040 | "peer": true, |
|
| 6974 | 7041 | "bin": { |
|
| 6975 | 7042 | "tsc": "bin/tsc", |
|
| 7039 | 7106 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", |
|
| 7040 | 7107 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", |
|
| 7041 | 7108 | "dev": true, |
|
| 7042 | - | "peer": true, |
|
| 7043 | 7109 | "dependencies": { |
|
| 7044 | 7110 | "punycode": "^2.1.0" |
|
| 7045 | 7111 | } |
|
| 7072 | 7138 | "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", |
|
| 7073 | 7139 | "dev": true, |
|
| 7074 | 7140 | "peer": true |
|
| 7141 | + | }, |
|
| 7142 | + | "node_modules/viem": { |
|
| 7143 | + | "version": "1.16.2", |
|
| 7144 | + | "resolved": "https://registry.npmjs.org/viem/-/viem-1.16.2.tgz", |
|
| 7145 | + | "integrity": "sha512-ZQ8kemNvRVwucwcsj4/SjKohK+wZv9Vxx/gXAlwqGMCW7r+niOeECtFku/1L7UPTmPgdmq4kic9R71t6XQDmGw==", |
|
| 7146 | + | "funding": [ |
|
| 7147 | + | { |
|
| 7148 | + | "type": "github", |
|
| 7149 | + | "url": "https://github.com/sponsors/wagmi-dev" |
|
| 7150 | + | } |
|
| 7151 | + | ], |
|
| 7152 | + | "dependencies": { |
|
| 7153 | + | "@adraffy/ens-normalize": "1.9.4", |
|
| 7154 | + | "@noble/curves": "1.2.0", |
|
| 7155 | + | "@noble/hashes": "1.3.2", |
|
| 7156 | + | "@scure/bip32": "1.3.2", |
|
| 7157 | + | "@scure/bip39": "1.2.1", |
|
| 7158 | + | "abitype": "0.9.8", |
|
| 7159 | + | "isows": "1.0.3", |
|
| 7160 | + | "ws": "8.13.0" |
|
| 7161 | + | }, |
|
| 7162 | + | "peerDependencies": { |
|
| 7163 | + | "typescript": ">=5.0.4" |
|
| 7164 | + | }, |
|
| 7165 | + | "peerDependenciesMeta": { |
|
| 7166 | + | "typescript": { |
|
| 7167 | + | "optional": true |
|
| 7168 | + | } |
|
| 7169 | + | } |
|
| 7170 | + | }, |
|
| 7171 | + | "node_modules/viem/node_modules/@adraffy/ens-normalize": { |
|
| 7172 | + | "version": "1.9.4", |
|
| 7173 | + | "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz", |
|
| 7174 | + | "integrity": "sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==" |
|
| 7175 | + | }, |
|
| 7176 | + | "node_modules/viem/node_modules/@noble/curves": { |
|
| 7177 | + | "version": "1.2.0", |
|
| 7178 | + | "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", |
|
| 7179 | + | "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", |
|
| 7180 | + | "dependencies": { |
|
| 7181 | + | "@noble/hashes": "1.3.2" |
|
| 7182 | + | }, |
|
| 7183 | + | "funding": { |
|
| 7184 | + | "url": "https://paulmillr.com/funding/" |
|
| 7185 | + | } |
|
| 7186 | + | }, |
|
| 7187 | + | "node_modules/viem/node_modules/@scure/bip32": { |
|
| 7188 | + | "version": "1.3.2", |
|
| 7189 | + | "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", |
|
| 7190 | + | "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", |
|
| 7191 | + | "dependencies": { |
|
| 7192 | + | "@noble/curves": "~1.2.0", |
|
| 7193 | + | "@noble/hashes": "~1.3.2", |
|
| 7194 | + | "@scure/base": "~1.1.2" |
|
| 7195 | + | }, |
|
| 7196 | + | "funding": { |
|
| 7197 | + | "url": "https://paulmillr.com/funding/" |
|
| 7198 | + | } |
|
| 7199 | + | }, |
|
| 7200 | + | "node_modules/viem/node_modules/ws": { |
|
| 7201 | + | "version": "8.13.0", |
|
| 7202 | + | "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", |
|
| 7203 | + | "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", |
|
| 7204 | + | "engines": { |
|
| 7205 | + | "node": ">=10.0.0" |
|
| 7206 | + | }, |
|
| 7207 | + | "peerDependencies": { |
|
| 7208 | + | "bufferutil": "^4.0.1", |
|
| 7209 | + | "utf-8-validate": ">=5.0.2" |
|
| 7210 | + | }, |
|
| 7211 | + | "peerDependenciesMeta": { |
|
| 7212 | + | "bufferutil": { |
|
| 7213 | + | "optional": true |
|
| 7214 | + | }, |
|
| 7215 | + | "utf-8-validate": { |
|
| 7216 | + | "optional": true |
|
| 7217 | + | } |
|
| 7218 | + | } |
|
| 7075 | 7219 | }, |
|
| 7076 | 7220 | "node_modules/web3-utils": { |
|
| 7077 | 7221 | "version": "1.10.2", |
|
| 2 | 2 | "name": "hardhat-project", |
|
| 3 | 3 | "devDependencies": { |
|
| 4 | 4 | "@nomicfoundation/hardhat-toolbox": "^3.0.0", |
|
| 5 | + | "@nomiclabs/hardhat-etherscan": "^3.1.7", |
|
| 5 | 6 | "hardhat": "^2.18.0", |
|
| 6 | 7 | "mocha": "^10.2.0" |
|
| 7 | 8 | }, |
|
| 8 | 9 | "dependencies": { |
|
| 9 | 10 | "@openzeppelin/contracts": "^5.0.0", |
|
| 11 | + | "@tokenbound/sdk": "^0.3.9", |
|
| 10 | 12 | "dotenv": "^16.3.1", |
|
| 11 | 13 | "ethers": "^6.7.1" |
|
| 12 | 14 | } |
| 1 | - | // We require the Hardhat Runtime Environment explicitly here. This is optional |
|
| 2 | - | // but useful for running the script in a standalone fashion through `node <script>`. |
|
| 3 | - | // |
|
| 4 | - | // You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat |
|
| 5 | - | // will compile your contracts, add the Hardhat Runtime Environment's members to the |
|
| 6 | - | // global scope, and execute the script. |
|
| 7 | - | const hre = require("hardhat"); |
|
| 8 | - | ||
| 9 | - | async function main() { |
|
| 10 | - | const currentTimestampInSeconds = Math.round(Date.now() / 1000); |
|
| 11 | - | const unlockTime = currentTimestampInSeconds + 60; |
|
| 12 | - | ||
| 13 | - | const lockedAmount = hre.ethers.parseEther("0.001"); |
|
| 14 | - | ||
| 15 | - | const lock = await hre.ethers.deployContract("Lock", [unlockTime], { |
|
| 16 | - | value: lockedAmount, |
|
| 17 | - | }); |
|
| 18 | - | ||
| 19 | - | await lock.waitForDeployment(); |
|
| 20 | - | ||
| 21 | - | console.log( |
|
| 22 | - | `Lock with ${ethers.formatEther( |
|
| 23 | - | lockedAmount |
|
| 24 | - | )}ETH and unlock timestamp ${unlockTime} deployed to ${lock.target}` |
|
| 25 | - | ); |
|
| 26 | - | } |
|
| 27 | - | ||
| 28 | - | // We recommend this pattern to be able to use async/await everywhere |
|
| 29 | - | // and properly handle errors. |
|
| 30 | - | main().catch((error) => { |
|
| 31 | - | console.error(error); |
|
| 32 | - | process.exitCode = 1; |
|
| 33 | - | }); |
| 1 | + | // Import the ethers library |
|
| 2 | + | const { ethers } = require("hardhat"); |
|
| 3 | + | const provider = new ethers.AlchemyProvider("goerli", process.env.ALCHEMY_KEY) |
|
| 4 | + | const { TokenboundClient } = require("@tokenbound/sdk"); |
|
| 5 | + | ||
| 6 | + | async function Operator() { |
|
| 7 | + | ||
| 8 | + | ||
| 9 | + | // Get the signers from ethers |
|
| 10 | + | const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) |
|
| 11 | + | const tokenboundClient = new TokenboundClient({ signer: wallet, chainId: 5 }) |
|
| 12 | + | console.log(`SERVER_WALLET_PRIVATE_KEY=${process.env.PRIVATE_KEY}`) |
|
| 13 | + | console.log(`SERVER_WALLET_ADDRESS=${wallet.address}`) |
|
| 14 | + | ||
| 15 | + | // Deploy NPC contract |
|
| 16 | + | const NPCContract = await ethers.getContractFactory("CosmicCowboys"); |
|
| 17 | + | const npcContract = await NPCContract.deploy(wallet.address); |
|
| 18 | + | const npcContractAddress = await npcContract.getAddress() |
|
| 19 | + | console.log(`NPC_CONTRACT_ADDRESS=${npcContractAddress}`); |
|
| 20 | + | ||
| 21 | + | // Deploy ERC-20 Contract |
|
| 22 | + | const CurrencyContract = await ethers.getContractFactory("GoldenCorn"); |
|
| 23 | + | const currencyContract = await CurrencyContract.deploy(wallet.address); |
|
| 24 | + | const currencyContractAddress = await currencyContract.getAddress() |
|
| 25 | + | console.log(`CURRENCY_CONTRACT_ADDRESS=${currencyContractAddress}`) |
|
| 26 | + | ||
| 27 | + | // Deploy 1155 Contracts |
|
| 28 | + | const FoodContract = await ethers.getContractFactory("SpaceSlop"); |
|
| 29 | + | const foodContract = await FoodContract.deploy(wallet.address); |
|
| 30 | + | const foodContractAddress = await foodContract.getAddress() |
|
| 31 | + | console.log(`FOOD_CONTRACT_ADDRESS=${foodContractAddress}`); |
|
| 32 | + | ||
| 33 | + | const SupplyContract = await ethers.getContractFactory("JupiterJunk"); |
|
| 34 | + | const supplyContract = await SupplyContract.deploy(wallet.address); |
|
| 35 | + | const supplyContractAddress = await supplyContract.getAddress() |
|
| 36 | + | console.log(`SUPPLY_CONTRACT_ADDRESS=${supplyContractAddress}`); |
|
| 37 | + | ||
| 38 | + | // Deploy ERC6551 |
|
| 39 | + | /* const RegistryContract = await ethers.getContractFactory("ERC6551Registry"); |
|
| 40 | + | const registryContract = await RegistryContract.deploy(); |
|
| 41 | + | const registryContractAddress = await registryContract.getAddress() |
|
| 42 | + | console.log("Registry Contract deployed to address:", registryContractAddress); |
|
| 43 | + | ||
| 44 | + | const AccountContract = await ethers.getContractFactory("ERC6551Account"); |
|
| 45 | + | const accountContract = await AccountContract.deploy(); |
|
| 46 | + | const accountContractAddress = await accountContract.getAddress() |
|
| 47 | + | console.log("Account Contract deployed to address:", accountContractAddress); */ |
|
| 48 | + | ||
| 49 | + | // Deploy Operator Contract |
|
| 50 | + | const OperatorContract = await ethers.getContractFactory("Operator"); |
|
| 51 | + | const operatorContract = await OperatorContract.deploy(wallet.address, npcContractAddress, currencyContractAddress, foodContractAddress, supplyContractAddress) |
|
| 52 | + | const operatorContractAddress = await operatorContract.getAddress() |
|
| 53 | + | console.log(`OPERATOR_CONTRACT_ADDRESS=${operatorContractAddress}`) |
|
| 54 | + | ||
| 55 | + | // Transfer NPC contract to Operator |
|
| 56 | + | await npcContract.transferOwnership(operatorContractAddress); |
|
| 57 | + | await currencyContract.transferOwnership(operatorContractAddress); |
|
| 58 | + | await foodContract.transferOwnership(operatorContractAddress); |
|
| 59 | + | await supplyContract.transferOwnership(operatorContractAddress); |
|
| 60 | + | ||
| 61 | + | for (let i = 0; i < 2; i++) { |
|
| 62 | + | // create NPC |
|
| 63 | + | const npcTx = await operatorContract.createNPC(wallet.address, `ipfs://QmQbwCMwDETHHZ1g8YaSHqLBwCRgVHqFuRNRfiGyNqCcXj/${i}.json`) |
|
| 64 | + | const npcTxReceipt = await npcTx.wait() |
|
| 65 | + | console.log("NPC Created") |
|
| 66 | + | ||
| 67 | + | // After the NPC is created |
|
| 68 | + | const latestTokenId = await operatorContract.getLatestTokenId(); |
|
| 69 | + | ||
| 70 | + | // create TBA for NPC |
|
| 71 | + | const tba = await tokenboundClient.createAccount({ |
|
| 72 | + | tokenContract: npcContractAddress, |
|
| 73 | + | tokenId: latestTokenId, |
|
| 74 | + | }) |
|
| 75 | + | console.log("TBA:", tba) |
|
| 76 | + | ||
| 77 | + | // equip NPC via TBA |
|
| 78 | + | ||
| 79 | + | const equipTx = await operatorContract.equipNPC(tba, 20, 5, 5) |
|
| 80 | + | const equipTxReceipt = await equipTx.wait() |
|
| 81 | + | console.log("NPC Equipped") |
|
| 82 | + | } |
|
| 83 | + | ||
| 84 | + | ||
| 85 | + | } |
|
| 86 | + | ||
| 87 | + | Operator() |
| 1 | + | // Import the ethers library |
|
| 2 | + | const { ethers } = require("hardhat"); |
|
| 3 | + | const provider = new ethers.AlchemyProvider("base-goerli", process.env.ALCHEMY_KEY_BASE) |
|
| 4 | + | const { TokenboundClient } = require("@tokenbound/sdk"); |
|
| 5 | + | ||
| 6 | + | async function Operator() { |
|
| 7 | + | ||
| 8 | + | ||
| 9 | + | // Get the signers from ethers |
|
| 10 | + | const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) |
|
| 11 | + | const tokenboundClient = new TokenboundClient({ signer: wallet, chainId: 84531 }) |
|
| 12 | + | console.log(`SERVER_WALLET_PRIVATE_KEY=${process.env.PRIVATE_KEY}`) |
|
| 13 | + | console.log(`SERVER_WALLET_ADDRESS=${wallet.address}`) |
|
| 14 | + | ||
| 15 | + | // Deploy NPC contract |
|
| 16 | + | const NPCContract = await ethers.getContractFactory("CosmicCowboys"); |
|
| 17 | + | const npcContract = await NPCContract.deploy(wallet.address); |
|
| 18 | + | const npcContractAddress = await npcContract.getAddress() |
|
| 19 | + | console.log(`NPC_CONTRACT_ADDRESS=${npcContractAddress}`); |
|
| 20 | + | ||
| 21 | + | // Deploy ERC-20 Contract |
|
| 22 | + | const CurrencyContract = await ethers.getContractFactory("GoldenCorn"); |
|
| 23 | + | const currencyContract = await CurrencyContract.deploy(wallet.address); |
|
| 24 | + | const currencyContractAddress = await currencyContract.getAddress() |
|
| 25 | + | console.log(`CURRENCY_CONTRACT_ADDRESS=${currencyContractAddress}`) |
|
| 26 | + | ||
| 27 | + | // Deploy 1155 Contracts |
|
| 28 | + | const FoodContract = await ethers.getContractFactory("SpaceSlop"); |
|
| 29 | + | const foodContract = await FoodContract.deploy(wallet.address); |
|
| 30 | + | const foodContractAddress = await foodContract.getAddress() |
|
| 31 | + | console.log(`FOOD_CONTRACT_ADDRESS=${foodContractAddress}`); |
|
| 32 | + | ||
| 33 | + | const SupplyContract = await ethers.getContractFactory("JupiterJunk"); |
|
| 34 | + | const supplyContract = await SupplyContract.deploy(wallet.address); |
|
| 35 | + | const supplyContractAddress = await supplyContract.getAddress() |
|
| 36 | + | console.log(`SUPPLY_CONTRACT_ADDRESS=${supplyContractAddress}`); |
|
| 37 | + | ||
| 38 | + | // Deploy ERC6551 |
|
| 39 | + | /* const RegistryContract = await ethers.getContractFactory("ERC6551Registry"); |
|
| 40 | + | const registryContract = await RegistryContract.deploy(); |
|
| 41 | + | const registryContractAddress = await registryContract.getAddress() |
|
| 42 | + | console.log("Registry Contract deployed to address:", registryContractAddress); |
|
| 43 | + | ||
| 44 | + | const AccountContract = await ethers.getContractFactory("ERC6551Account"); |
|
| 45 | + | const accountContract = await AccountContract.deploy(); |
|
| 46 | + | const accountContractAddress = await accountContract.getAddress() |
|
| 47 | + | console.log("Account Contract deployed to address:", accountContractAddress); */ |
|
| 48 | + | ||
| 49 | + | // Deploy Operator Contract |
|
| 50 | + | const OperatorContract = await ethers.getContractFactory("Operator"); |
|
| 51 | + | const operatorContract = await OperatorContract.deploy(wallet.address, npcContractAddress, currencyContractAddress, foodContractAddress, supplyContractAddress) |
|
| 52 | + | const operatorContractAddress = await operatorContract.getAddress() |
|
| 53 | + | console.log(`OPERATOR_CONTRACT_ADDRESS=${operatorContractAddress}`) |
|
| 54 | + | ||
| 55 | + | // Transfer NPC contract to Operator |
|
| 56 | + | await npcContract.transferOwnership(operatorContractAddress); |
|
| 57 | + | await currencyContract.transferOwnership(operatorContractAddress); |
|
| 58 | + | await foodContract.transferOwnership(operatorContractAddress); |
|
| 59 | + | await supplyContract.transferOwnership(operatorContractAddress); |
|
| 60 | + | ||
| 61 | + | for (let i = 0; i < 2; i++) { |
|
| 62 | + | // create NPC |
|
| 63 | + | const npcTx = await operatorContract.createNPC(wallet.address, `ipfs://QmQbwCMwDETHHZ1g8YaSHqLBwCRgVHqFuRNRfiGyNqCcXj/${i}.json`) |
|
| 64 | + | const npcTxReceipt = await npcTx.wait() |
|
| 65 | + | console.log("NPC Created") |
|
| 66 | + | ||
| 67 | + | // After the NPC is created |
|
| 68 | + | const latestTokenId = await operatorContract.getLatestTokenId(); |
|
| 69 | + | ||
| 70 | + | // create TBA for NPC |
|
| 71 | + | const tba = await tokenboundClient.createAccount({ |
|
| 72 | + | tokenContract: npcContractAddress, |
|
| 73 | + | tokenId: latestTokenId, |
|
| 74 | + | }) |
|
| 75 | + | console.log("TBA:", tba) |
|
| 76 | + | ||
| 77 | + | // equip NPC via TBA |
|
| 78 | + | ||
| 79 | + | const equipTx = await operatorContract.equipNPC(tba, 20, 5, 5) |
|
| 80 | + | const equipTxReceipt = await equipTx.wait() |
|
| 81 | + | console.log("NPC Equipped") |
|
| 82 | + | } |
|
| 83 | + | ||
| 84 | + | ||
| 85 | + | } |
|
| 86 | + | ||
| 87 | + | Operator() |
| 1 | + | //const { ethers } = require("hardhat"); |
|
| 2 | + | const ethers = require("ethers") |
|
| 3 | + | const provider = new ethers.AlchemyProvider("goerli", process.env.ALCHEMY_KEY) |
|
| 4 | + | const operatorAbi = require("../artifacts/contracts/Operator.sol/Operator.json") |
|
| 5 | + | const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) |
|
| 6 | + | const { TokenboundClient } = require("@tokenbound/sdk"); |
|
| 7 | + | ||
| 8 | + | ||
| 9 | + | const main = async () => { |
|
| 10 | + | ||
| 11 | + | const operatorContract = new ethers.Contract(process.env.OPERATOR_CONTRACT_ADDRESS, operatorAbi.abi, wallet) |
|
| 12 | + | const tokenboundClient = new TokenboundClient({ signer: wallet, chainId: 5 }) |
|
| 13 | + | ||
| 14 | + | ||
| 15 | + | for (let i = 0; i < 19; i++) { |
|
| 16 | + | // create NPC |
|
| 17 | + | const npcTx = await operatorContract.createNPC(wallet.address, `ipfs://QmQbwCMwDETHHZ1g8YaSHqLBwCRgVHqFuRNRfiGyNqCcXj/${i}.json`) |
|
| 18 | + | const npcTxReceipt = await npcTx.wait() |
|
| 19 | + | console.log("NPC Created") |
|
| 20 | + | ||
| 21 | + | // After the NPC is created |
|
| 22 | + | const latestTokenId = await operatorContract.getLatestTokenId(); |
|
| 23 | + | ||
| 24 | + | // create TBA for NPC |
|
| 25 | + | const tba = await tokenboundClient.createAccount({ |
|
| 26 | + | tokenContract: process.env.NPC_CONTRACT_ADDRESS, |
|
| 27 | + | tokenId: latestTokenId, |
|
| 28 | + | }) |
|
| 29 | + | console.log("TBA:", tba) |
|
| 30 | + | ||
| 31 | + | // equip NPC via TBA |
|
| 32 | + | ||
| 33 | + | const equipTx = await operatorContract.equipNPC(tba, 20, 5, 5) |
|
| 34 | + | const equipTxReceipt = await equipTx.wait() |
|
| 35 | + | console.log("NPC Equipped") |
|
| 36 | + | } |
|
| 37 | + | } |
|
| 38 | + | ||
| 39 | + | main() |
| 1 | 1 | // Import the ethers library |
|
| 2 | 2 | const { ethers } = require("hardhat"); |
|
| 3 | + | const { TokenboundClient } = require("@tokenbound/sdk"); |
|
| 4 | + | const provider = new ethers.AlchemyProvider("goerli", process.env.ALCHEMY_KEY) |
|
| 5 | + | const operatorAbi = require("../artifacts/contracts/Operator.sol/Operator.json") |
|
| 3 | 6 | ||
| 4 | - | async function Operator() { |
|
| 5 | 7 | ||
| 6 | - | let owner; |
|
| 7 | - | let addr1; |
|
| 8 | - | let addr2; |
|
| 9 | - | let deployedAccountTx, deployedAccountReceipt, deployedAccountAddress; |
|
| 8 | + | async function Operator() { |
|
| 10 | 9 | ||
| 11 | 10 | // Get the signers from ethers |
|
| 12 | - | [owner, addr1, addr2] = await ethers.getSigners(); |
|
| 11 | + | let owner; |
|
| 12 | + | [owner] = await ethers.getSigners(); |
|
| 13 | + | const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider) |
|
| 14 | + | console.log(`SERVER_WALLET_PRIVATE_KEY=${process.env.PRIVATE_KEY}`) |
|
| 15 | + | console.log(`SERVER_WALLET_ADDRESS=${wallet.address}`) |
|
| 16 | + | const tokenboundClient = new TokenboundClient({ signer: wallet, chainId: 5 }) |
|
| 13 | 17 | ||
| 14 | 18 | // Deploy NPC contract |
|
| 15 | 19 | const NPCContract = await ethers.getContractFactory("CosmicCowboys"); |
|
| 16 | 20 | const npcContract = await NPCContract.deploy(owner.address); |
|
| 17 | 21 | const npcContractAddress = await npcContract.getAddress() |
|
| 18 | - | console.log("NPC Contract deployed to address:", npcContractAddress); |
|
| 22 | + | console.log(`NPC_CONTRACT_ADDRESS=${npcContractAddress}`); |
|
| 19 | 23 | ||
| 20 | 24 | // Deploy ERC-20 Contract |
|
| 21 | 25 | const CurrencyContract = await ethers.getContractFactory("GoldenCorn"); |
|
| 22 | 26 | const currencyContract = await CurrencyContract.deploy(owner.address); |
|
| 23 | 27 | const currencyContractAddress = await currencyContract.getAddress() |
|
| 24 | - | console.log("Currency Contract deployed to address:", currencyContractAddress); |
|
| 28 | + | console.log(`CURRENCY_CONTRACT_ADDRESS=${currencyContractAddress}`) |
|
| 25 | 29 | ||
| 26 | 30 | // Deploy 1155 Contracts |
|
| 27 | 31 | const FoodContract = await ethers.getContractFactory("SpaceSlop"); |
|
| 28 | 32 | const foodContract = await FoodContract.deploy(owner.address); |
|
| 29 | 33 | const foodContractAddress = await foodContract.getAddress() |
|
| 30 | - | console.log("Food Contract deployed to address:", foodContractAddress); |
|
| 34 | + | console.log(`FOOD_CONTRACT_ADDRESS=${foodContractAddress}`); |
|
| 31 | 35 | ||
| 32 | 36 | const SupplyContract = await ethers.getContractFactory("JupiterJunk"); |
|
| 33 | 37 | const supplyContract = await SupplyContract.deploy(owner.address); |
|
| 34 | 38 | const supplyContractAddress = await supplyContract.getAddress() |
|
| 35 | - | console.log("Supply Contract deployed to address:", supplyContractAddress); |
|
| 39 | + | console.log(`SUPPLY_CONTRACT_ADDRESS=${supplyContractAddress}`); |
|
| 36 | 40 | ||
| 37 | 41 | // Deploy ERC6551 |
|
| 38 | 42 | /* const RegistryContract = await ethers.getContractFactory("ERC6551Registry"); |
|
| 49 | 53 | const OperatorContract = await ethers.getContractFactory("Operator"); |
|
| 50 | 54 | const operatorContract = await OperatorContract.deploy(owner.address, npcContractAddress, currencyContractAddress, foodContractAddress, supplyContractAddress) |
|
| 51 | 55 | const operatorContractAddress = await operatorContract.getAddress() |
|
| 52 | - | console.log("Operator Contract deployed to address:", operatorContractAddress) |
|
| 56 | + | console.log("OPERATOR_CONTRACT_ADDRESS", operatorContractAddress) |
|
| 57 | + | ||
| 58 | + | /* const operatorContract = new ethers.Contract("0x575C0B5777eF7F620E51ff33b33ccB854B856e84", operatorAbi.abi, wallet) |
|
| 59 | + | npcContractAddress = "0xF0fEFC86335E227c85aA778b24061B6B70B80Ef4" */ |
|
| 53 | 60 | ||
| 54 | 61 | // Transfer NPC contract to Operator |
|
| 55 | 62 | await npcContract.transferOwnership(operatorContractAddress); |
|
| 57 | 64 | await foodContract.transferOwnership(operatorContractAddress); |
|
| 58 | 65 | await supplyContract.transferOwnership(operatorContractAddress); |
|
| 59 | 66 | ||
| 60 | - | /* // create NPC |
|
| 61 | - | const npcTx = await operatorContract.createNPC(owner.address, "ipfs://") |
|
| 67 | + | const npcTx = await operatorContract.createNPC(owner.address, `ipfs://QmQbwCMwDETHHZ1g8YaSHqLBwCRgVHqFuRNRfiGyNqCcXj/1.json`) |
|
| 62 | 68 | const npcTxReceipt = await npcTx.wait() |
|
| 69 | + | console.log("NFT Minted") |
|
| 70 | + | ||
| 71 | + | const stats = await operatorContract.getNPCStats(0) |
|
| 72 | + | console.log(stats) |
|
| 63 | 73 | ||
| 64 | - | // After the NPC is created |
|
| 65 | - | const latestTokenId = await operatorContract.getLatestTokenId(); |
|
| 66 | - | console.log("Latest Token ID:", latestTokenId.toString()); |
|
| 74 | + | ||
| 75 | + | /* for (let i = 16; i < 21; i++) { |
|
| 76 | + | // create NPC |
|
| 77 | + | const npcTx = await operatorContract.createNPC(owner.address, `ipfs://QmQbwCMwDETHHZ1g8YaSHqLBwCRgVHqFuRNRfiGyNqCcXj/${i}.json`) |
|
| 78 | + | const npcTxReceipt = await npcTx.wait() |
|
| 79 | + | console.log("NPC Created") |
|
| 67 | 80 | ||
| 68 | - | // create TBA for NPC |
|
| 69 | - | deployedAccountTx = await registryContract.createAccount( |
|
| 70 | - | accountContractAddress, |
|
| 71 | - | 5, |
|
| 72 | - | npcContractAddress, |
|
| 73 | - | latestTokenId.toString(), |
|
| 74 | - | 0, |
|
| 75 | - | "0x" |
|
| 76 | - | ) |
|
| 77 | - | deployedAccountReceipt = await deployedAccountTx.wait() |
|
| 78 | - | console.log(deployedAccountReceipt) */ |
|
| 81 | + | // After the NPC is created |
|
| 82 | + | const latestTokenId = await operatorContract.getLatestTokenId(); |
|
| 83 | + | ||
| 84 | + | // create TBA for NPC |
|
| 85 | + | const tba = await tokenboundClient.createAccount({ |
|
| 86 | + | tokenContract: npcContractAddress, |
|
| 87 | + | tokenId: latestTokenId, |
|
| 88 | + | }) |
|
| 89 | + | console.log("TBA:", tba) |
|
| 79 | 90 | ||
| 80 | - | // equip NPC via TBA |
|
| 91 | + | // equip NPC via TBA |
|
| 81 | 92 | ||
| 93 | + | const equipTx = await operatorContract.equipNPC(tba, 20, 5, 5) |
|
| 94 | + | const equipTxReceipt = await equipTx.wait() |
|
| 95 | + | console.log("NPC Equipped") |
|
| 96 | + | } */ |
|
| 82 | 97 | } |
|
| 83 | 98 | ||
| 84 | 99 | Operator() |
|