Skip to content

Commit

Permalink
add script for nft deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
thurendous committed Oct 23, 2024
1 parent 19c3516 commit b90ee7e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PRIVATE_KEY_DEPLOYER=1234567890123456789012345678901234567890123456789012345678901234
PRIVATE_KEY_DEV=1234567890123456789012345678901234567890123456789012345678901234
PRIVATE_KEY_DEPLOYER=12345...
PRIVATE_KEY_DEV=12345...
ETHERSCAN_API_KEY=
BASE_API_KEY=
BASE_SEPOLIA_RPC_URL=
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ endif

deploy:
@forge clean && forge script script/DeployContracts.s.sol:DeployContracts $(NETWORK_ARGS)

deploy-nft:
@forge clean && forge script script/DeployNft.s.sol:DeployNft $(NETWORK_ARGS)
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,18 @@ make test
make coverage
```

7. Deploy the contracts on the base sepolia network by running

```shell
make deploy ARGS="--network basesepolia"
```

8. Deploy the nft contract on the base sepolia network by running

```shell
make deploy-nft ARGS="--network basesepolia"
```

## References

### Mathematical Formula and tables
Expand Down
23 changes: 20 additions & 3 deletions script/DeployNft.s.sol
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
// DeployNft.s.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.24;

import {console, Script} from "forge-std/Script.sol";
import {Script, console} from "forge-std/Script.sol";
import {AmbassadorNft} from "src/AmbassadorNft.sol";

contract DeployNft is Script {
function run() public {
vm.startBroadcast();
address defender = vm.envAddress("OPENZEPPELIN_DEFENDER_ADDR");
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_DEPLOYER");
address deployer = vm.addr(deployerPrivateKey);
address admin = deployer;
address minter = defender;
address burner = defender;
address uriSetter = defender;

vm.startBroadcast(deployerPrivateKey);

AmbassadorNft nft = new AmbassadorNft(
admin,
minter,
burner,
uriSetter
);

console.log("Deployer:", deployer);
console.log("AmbassadorNft deployed at:", address(nft));

vm.stopBroadcast();
}
Expand Down
2 changes: 1 addition & 1 deletion src/AmbassadorNft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract AmbassadorNft is ERC1155, AccessControl, ERC1155Burnable {
_burn(account, id, amount);
}

/// @notice Batch burning is not supported.
/// @notice Batch burning is supported only by the BURNER_ROLE.
function burnBatch(address account, uint256[] memory ids, uint256[] memory values)
public
virtual
Expand Down

0 comments on commit b90ee7e

Please sign in to comment.