Skip to content

Commit

Permalink
NFT minting works without a payment mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan J. Solomon committed Sep 20, 2024
1 parent c0d7751 commit a0c9125
Show file tree
Hide file tree
Showing 15 changed files with 601 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/foundry-devops"]
path = lib/foundry-devops
url = https://github.com/Cyfrin/foundry-devops
42 changes: 42 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

-include .env

.PHONY: all test clean deploy fund help install snapshot format anvil zktest

DEFAULT_ANVIL_KEY := 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
SEPOLIA_RPC_URL := https://eth-sepolia.g.alchemy.com/v2/ZXm5pI0v-lpLywpHjxW33bIKWLrnH38j

all: clean remove install update build

# Clean the repo
clean :; forge clean

# Remove modules
remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"

install :; forge install cyfrin/foundry-devops@0.2.2 --no-commit && forge install foundry-rs/forge-std@v1.8.2 --no-commit && forge install openzeppelin/openzeppelin-contracts@v5.0.2 --no-commit

# Update Dependencies
update:; forge update

build:; forge build

test :; forge test

snapshot :; forge snapshot

format :; forge fmt

anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1

NETWORK_ARGS := --rpc-url http://localhost:8545 --private-key $(DEFAULT_ANVIL_KEY) --broadcast

ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia)
NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --private-key $(PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
endif

deploy:
@forge script script/DeployWhaleNFT.s.sol:DeployWhaleNFT $(NETWORK_ARGS)

mint:
@forge script script/WhaleNFTInteractions.s.sol:WhaleNFTInteractions ${NETWORK_ARGS}
6 changes: 6 additions & 0 deletions NFTStats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "WhaleNFT",
"description": "This is a whale captured in Antarctica. This is the best photo i have taken in my life. My pride and joy.",
"image": "https://ipfs.io/ipfs/QmUu68RfYEq6ssS6gtCosXWbSAZMirEEd6RxLYEtM6EFet?filename=P1040846.jpg",
"attributes": []
}
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
## Foundry

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

Foundry consists of:

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.

## Documentation

https://book.getfoundry.sh/

## Usage

### Build

```shell
$ forge build
```

### Test

```shell
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```

### Cast

```shell
$ cast <subcommand>
```

### Help

```shell
$ forge --help
$ anvil --help
$ cast --help
```
51 changes: 51 additions & 0 deletions broadcast/DeployWhaleNFT.s.sol/11155111/run-1726847687.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"transactions": [
{
"hash": "0xe4b89c35b7b200f98204d41091eebb0b37b4ad814d5c75525ebd344566b2bd98",
"transactionType": "CREATE",
"contractName": "WhaleNFT",
"contractAddress": "0x043b02d4fd96eb8e015dd3e58769cb8072e136bb",
"function": null,
"arguments": null,
"transaction": {
"from": "0xac5dddf779629add7c8f3e7e9d605d9b090c778c",
"gas": "0x15d757",
"value": "0x0",
"input": "0x608060405260646009553480156200001657600080fd5b506040518060400160405280600881526020016715da185b1953919560c21b8152506040518060400160405280600381526020016215d21560ea1b81525081600090816200006591906200012e565b5060016200007482826200012e565b50506001600681905560095550620001fa565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620000b257607f821691505b602082108103620000d357634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000129576000816000526020600020601f850160051c81016020861015620001045750805b601f850160051c820191505b81811015620001255782815560010162000110565b5050505b505050565b81516001600160401b038111156200014a576200014a62000087565b62000162816200015b84546200009d565b84620000d9565b602080601f8311600181146200019a5760008415620001815750858301515b600019600386901b1c1916600185901b17855562000125565b600085815260208120601f198616915b82811015620001cb57888601518255948401946001909101908401620001aa565b5085821015620001ea5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611134806200020a6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80636e02007d116100a2578063a22cb46511610071578063a22cb46514610215578063b88d4fde14610228578063c87b56dd1461023b578063da86f4a91461024e578063e985e9c51461026157600080fd5b80636e02007d146101dd57806370a08231146101e557806374239b63146101f857806395d89b411461020d57600080fd5b80630b21a83b116100de5780630b21a83b1461018d57806323b872dd146101a457806342842e0e146101b75780636352211e146101ca57600080fd5b806301ffc9a71461011057806306fdde0314610138578063081812fc1461014d578063095ea7b314610178575b600080fd5b61012361011e366004610c2b565b610274565b60405190151581526020015b60405180910390f35b6101406102c6565b60405161012f9190610c95565b61016061015b366004610ca8565b610358565b6040516001600160a01b03909116815260200161012f565b61018b610186366004610cdd565b610381565b005b61019660095481565b60405190815260200161012f565b61018b6101b2366004610d07565b610390565b61018b6101c5366004610d07565b610420565b6101606101d8366004610ca8565b610440565b600954610196565b6101966101f3366004610d43565b61044b565b33600090815260076020526040902054610196565b610140610493565b61018b610223366004610d5e565b6104a2565b61018b610236366004610e26565b6104ad565b610140610249366004610ca8565b6104c4565b61018b61025c366004610ea2565b610596565b61012361026f366004610eeb565b610650565b60006001600160e01b031982166380ac58cd60e01b14806102a557506001600160e01b03198216635b5e139f60e01b145b806102c057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102d590610f1e565b80601f016020809104026020016040519081016040528092919081815260200182805461030190610f1e565b801561034e5780601f106103235761010080835404028352916020019161034e565b820191906000526020600020905b81548152906001019060200180831161033157829003601f168201915b5050505050905090565b60006103638261067e565b506000828152600460205260409020546001600160a01b03166102c0565b61038c8282336106b7565b5050565b6001600160a01b0382166103bf57604051633250574960e11b8152600060048201526024015b60405180910390fd5b60006103cc8383336106c4565b9050836001600160a01b0316816001600160a01b03161461041a576040516364283d7b60e01b81526001600160a01b03808616600483015260248201849052821660448201526064016103b6565b50505050565b61043b838383604051806020016040528060008152506104ad565b505050565b60006102c08261067e565b60006001600160a01b038216610477576040516322718ad960e21b8152600060048201526024016103b6565b506001600160a01b031660009081526003602052604090205490565b6060600180546102d590610f1e565b61038c3383836107bd565b6104b8848484610390565b61041a8484848461085c565b606060006104d183610440565b6001600160a01b0316036104f8576040516345bdbe3560e11b815260040160405180910390fd5b6000828152600860205260409020805461051190610f1e565b80601f016020809104026020016040519081016040528092919081815260200182805461053d90610f1e565b801561058a5780601f1061055f5761010080835404028352916020019161058a565b820191906000526020600020905b81548152906001019060200180831161056d57829003601f168201915b50505050509050919050565b606460095411156105ba5760405163757976c160e11b815260040160405180910390fd5b6105c2610985565b6105ce336009546109af565b60095460009081526008602052604090206105e98282610fa8565b5060095433600090815260076020526040902081905561060a90600161107e565b600981905561061b90600190611091565b6040517e8a7e53d20e24b4664bdd0f2049a07dab2bb7fa7fee5e1f17809cb7c5ffa8f190600090a261064d6001600655565b50565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6000818152600260205260408120546001600160a01b0316806102c057604051637e27328960e01b8152600481018490526024016103b6565b61043b83838360016109c9565b6000828152600260205260408120546001600160a01b03908116908316156106f1576106f1818486610acf565b6001600160a01b0381161561072f5761070e6000856000806109c9565b6001600160a01b038116600090815260036020526040902080546000190190555b6001600160a01b0385161561075e576001600160a01b0385166000908152600360205260409020805460010190555b60008481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b6001600160a01b0382166107ef57604051630b61174360e31b81526001600160a01b03831660048201526024016103b6565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b1561041a57604051630a85bd0160e11b81526001600160a01b0384169063150b7a029061089e9033908890879087906004016110a4565b6020604051808303816000875af19250505080156108d9575060408051601f3d908101601f191682019092526108d6918101906110e1565b60015b610942573d808015610907576040519150601f19603f3d011682016040523d82523d6000602084013e61090c565b606091505b50805160000361093a57604051633250574960e11b81526001600160a01b03851660048201526024016103b6565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b1461097e57604051633250574960e11b81526001600160a01b03851660048201526024016103b6565b5050505050565b6002600654036109a857604051633ee5aeb560e01b815260040160405180910390fd5b6002600655565b61038c828260405180602001604052806000815250610b33565b80806109dd57506001600160a01b03821615155b15610a9f5760006109ed8461067e565b90506001600160a01b03831615801590610a195750826001600160a01b0316816001600160a01b031614155b8015610a2c5750610a2a8184610650565b155b15610a555760405163a9fbf51f60e01b81526001600160a01b03841660048201526024016103b6565b8115610a9d5783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b5050600090815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b610ada838383610b4a565b61043b576001600160a01b038316610b0857604051637e27328960e01b8152600481018290526024016103b6565b60405163177e802f60e01b81526001600160a01b0383166004820152602481018290526044016103b6565b610b3d8383610bb0565b61043b600084848461085c565b60006001600160a01b03831615801590610ba85750826001600160a01b0316846001600160a01b03161480610b845750610b848484610650565b80610ba857506000828152600460205260409020546001600160a01b038481169116145b949350505050565b6001600160a01b038216610bda57604051633250574960e11b8152600060048201526024016103b6565b6000610be8838360006106c4565b90506001600160a01b0381161561043b576040516339e3563760e11b8152600060048201526024016103b6565b6001600160e01b03198116811461064d57600080fd5b600060208284031215610c3d57600080fd5b8135610c4881610c15565b9392505050565b6000815180845260005b81811015610c7557602081850181015186830182015201610c59565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610c486020830184610c4f565b600060208284031215610cba57600080fd5b5035919050565b80356001600160a01b0381168114610cd857600080fd5b919050565b60008060408385031215610cf057600080fd5b610cf983610cc1565b946020939093013593505050565b600080600060608486031215610d1c57600080fd5b610d2584610cc1565b9250610d3360208501610cc1565b9150604084013590509250925092565b600060208284031215610d5557600080fd5b610c4882610cc1565b60008060408385031215610d7157600080fd5b610d7a83610cc1565b915060208301358015158114610d8f57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115610dcb57610dcb610d9a565b604051601f8501601f19908116603f01168101908282118183101715610df357610df3610d9a565b81604052809350858152868686011115610e0c57600080fd5b858560208301376000602087830101525050509392505050565b60008060008060808587031215610e3c57600080fd5b610e4585610cc1565b9350610e5360208601610cc1565b925060408501359150606085013567ffffffffffffffff811115610e7657600080fd5b8501601f81018713610e8757600080fd5b610e9687823560208401610db0565b91505092959194509250565b600060208284031215610eb457600080fd5b813567ffffffffffffffff811115610ecb57600080fd5b8201601f81018413610edc57600080fd5b610ba884823560208401610db0565b60008060408385031215610efe57600080fd5b610f0783610cc1565b9150610f1560208401610cc1565b90509250929050565b600181811c90821680610f3257607f821691505b602082108103610f5257634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561043b576000816000526020600020601f850160051c81016020861015610f815750805b601f850160051c820191505b81811015610fa057828155600101610f8d565b505050505050565b815167ffffffffffffffff811115610fc257610fc2610d9a565b610fd681610fd08454610f1e565b84610f58565b602080601f83116001811461100b5760008415610ff35750858301515b600019600386901b1c1916600185901b178555610fa0565b600085815260208120601f198616915b8281101561103a5788860151825594840194600190910190840161101b565b50858210156110585787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b808201808211156102c0576102c0611068565b818103818111156102c0576102c0611068565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906110d790830184610c4f565b9695505050505050565b6000602082840312156110f357600080fd5b8151610c4881610c1556fea2646970667358221220de151caaf0fa84da6d78927c6bd7ac24f6046dd1467259f5929f9f735355f1cc64736f6c63430008180033",
"nonce": "0x1d",
"chainId": "0xaa36a7"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0xf249fa",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x2",
"transactionHash": "0xe4b89c35b7b200f98204d41091eebb0b37b4ad814d5c75525ebd344566b2bd98",
"transactionIndex": "0x6e",
"blockHash": "0x0087ef2c404a74807b569122b9efb86a82edc4d016dc351489b69c8ed85dfdeb",
"blockNumber": "0x66a95d",
"gasUsed": "0x10ce3c",
"effectiveGasPrice": "0x40c9ef6fb",
"from": "0xac5dddf779629add7c8f3e7e9d605d9b090c778c",
"to": null,
"contractAddress": "0x043b02d4fd96eb8e015dd3e58769cb8072e136bb"
}
],
"libraries": [],
"pending": [],
"returns": {
"0": {
"internal_type": "contract WhaleNFT",
"value": "0x043b02D4Fd96Eb8e015dD3e58769cb8072e136BB"
}
},
"timestamp": 1726847687,
"chain": 11155111,
"commit": "c0d7751"
}
Loading

0 comments on commit a0c9125

Please sign in to comment.