Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to Mantle #220

Merged
merged 7 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ DEFENDER_TEAM_API_KEY=
DEFENDER_TEAM_API_SECRET_KEY=
TESTNET_PRIVATE_KEY=
MAINNET_PRIVATE_KEY=
MAINNET_PRIVATE_KEY_PUBLIC_ADDRESS=
CLAIM_SIGNER_ADDRESS=
ALCHEMY_GOERLI_API_KEY=
ALCHEMY_MAINNET_API_KEY=
ALCHEMY_POLYGON_API_KEY=
Expand Down
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For more information on all docs related to the Quest Protocol, see the document

## Addresses

Mainnet, Optimism, Polygon, Arbitrum, Base and Sepolia:
Mainnet, Optimism, Polygon, Arbitrum, Base, Mantle and Sepolia:

|Contract Name|Address|
|-------------|-------|
Expand Down Expand Up @@ -113,6 +113,7 @@ More reading [here](https://dev.to/jamiescript/design-patterns-in-solidity-1i28#

```bash
bun install
forge install
```

### Compile Contracts
Expand Down Expand Up @@ -150,31 +151,24 @@ If you see something like this `expected error: 0xdd8133e6 != 0xce3f0005` in For
## Deployment
1. Deploy the ProxyAdmin
`forge script script/ProxyAdmin.s.sol:ProxyAdminDeploy --rpc-url sepolia --broadcast --verify -vvvv`
2. Deploy QuestFactory (this also upgrades it to the latest version)
1. Deploy QuestFactory (this also upgrades it to the latest version, and deployes the latest Quest and Quest1155 implementation contracts)
`forge script script/QuestFactory.s.sol:QuestFactoryDeploy --rpc-url sepolia --broadcast --verify -vvvv`
3. Deploy RabbitHoleTickets (this also upgrades it to the latest version)
1. Deploy RabbitHoleTickets (this also upgrades it to the latest version)
`forge script script/RabbitHoleTickets.s.sol:RabbitHoleTicketsDeploy --rpc-url sepolia --broadcast --verify -vvvv`
4. Deploy Quest
`forge script script/Quest.s.sol:QuestDeploy --rpc-url sepolia --broadcast --verify -vvvv`
5. Deploy Quest1155
`forge script script/Quest.s.sol:Quest1155Deploy --rpc-url sepolia --broadcast --verify -vvvv`
6. Set any storage variables manually if need be.

### Depricated hardhat-deploy method
#### RabbitHoleReceipt and QuestFactory
- checkout from sha `ea60f723fadfb5f02edad862f56072c0c972cfc2`

#### QuestTerminalKey
- checkout from sha `fbc3c0fb7fdf13713314b996fa20a2551f9d591e`
1. Set any storage variables manually if need be (most likely the `protocolFeeRecipient` will need to be set)

#### RabbitHoleTickets
- checkout from sha `70a56a1567dcd9c4d6f7718388667c5e0564fb2f`
(must add in the deploy script manually)
### with mantel, add:
`--legacy --verifier blockscout --verifier-url "https://explorer.mantle.xyz/api?module=contract&action=verify"`
if you get `(code: -32000, message: invalid transaction: nonce too low, data: None)` try rerunning with the `--resume` flag

then:
- `yarn hardhat deploy --network network_name`
- `yarn hardhat --network network_name etherscan-verify --api-key etherscan_api_key`
### with scroll, add:
`--legacy --verifier blockscout --verifier-url "https://blockscout.scroll.io/api?module=contract&action=verify"`

### verify OZ TransparentProxy
Note: This might not be needed, there is currently a bug in the mantle explorer that prevents it from marking create2 contracts as contracts
```
forge verify-contract --verifier blockscout --verifier-url "https://explorer.mantle.xyz/api?module=contract&action=verify" --num-of-optimizations 999999 --chain 5000 --compiler-version "0.8.10+commit.fc410830" 0x52629961F71C1C2564C5aa22372CB1b9fa9EBA3E lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy
```

## Upgrading

Expand All @@ -187,6 +181,8 @@ Then to upgrade a contract, run one of the following commands:
`forge script script/Quest.s.sol:QuestDeploy --rpc-url sepolia --broadcast --verify -vvvv`
`forge script script/Quest.s.sol:Quest1155Deploy --rpc-url sepolia --broadcast --verify -vvvv`

Note the extra options to use with mantel and scroll above.

---

## Audits
Expand Down
62 changes: 62 additions & 0 deletions broadcast/ProxyAdmin.s.sol/5000/run-1697136284.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"transactions": [
{
"hash": "0x8e04429d190ad69e9146fff3ecbcd29cf483d8ed1a568e555bc045560a899640",
"transactionType": "CREATE2",
"contractName": null,
"contractAddress": "0xD28fbF7569f31877922cDc31a1A5B3C504E8faa1",
"function": null,
"arguments": null,
"transaction": {
"type": "0x00",
"from": "0x017f8ad14a2e745ea0f756bd57cd4852400be78c",
"to": "0x4e59b44847b379578588920ca78fbf26c0b4956c",
"gas": "0xe6685",
"value": "0x0",
"data": "0x0000000000000000000000000000000000000000000000000000000000000020608060405234801561001057600080fd5b50604051610b17380380610b1783398101604081905261002f91610090565b8061003981610040565b50506100c0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100a257600080fd5b81516001600160a01b03811681146100b957600080fd5b9392505050565b610a48806100cf6000396000f3fe60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b3660046107e4565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb366004610808565b6102e7565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610870565b6103ee565b34801561014a57600080fd5b506100de610159366004610808565b6104fc565b34801561016a57600080fd5b506100de6101793660046107e4565b6105d1565b34801561018a57600080fd5b506100a06101993660046107e4565b610701565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610964565b949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6102e5600061074d565b565b60005473ffffffffffffffffffffffffffffffffffffffff163314610368576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156103d257600080fd5b505af11580156103e6573d6000803e3d6000fd5b505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461046f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef2869034906104c59086908690600401610981565b6000604051808303818588803b1580156104de57600080fd5b505af11580156104f2573d6000803e3d6000fd5b5050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461057d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016103b8565b60005473ffffffffffffffffffffffffffffffffffffffff163314610652576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102d2565b73ffffffffffffffffffffffffffffffffffffffff81166106f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102d2565b6106fe8161074d565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146106fe57600080fd5b6000602082840312156107f657600080fd5b8135610801816107c2565b9392505050565b6000806040838503121561081b57600080fd5b8235610826816107c2565b91506020830135610836816107c2565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008060006060848603121561088557600080fd5b8335610890816107c2565b925060208401356108a0816107c2565b9150604084013567ffffffffffffffff808211156108bd57600080fd5b818601915086601f8301126108d157600080fd5b8135818111156108e3576108e3610841565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561092957610929610841565b8160405282815289602084870101111561094257600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561097657600080fd5b8151610801816107c2565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156109cb578581018301518582016060015282016109af565b818111156109dd576000606083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160600194935050505056fea2646970667358221220bd6c09ab03bfaf9ec60a4bf8cd98903cecb891974e17e2d76a3b2002c97eeb8964736f6c634300080a0033000000000000000000000000017f8ad14a2e745ea0f756bd57cd4852400be78c",
"nonce": "0x0"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"transactionHash": "0x8e04429d190ad69e9146fff3ecbcd29cf483d8ed1a568e555bc045560a899640",
"transactionIndex": "0x0",
"blockHash": "0x9dad2d2e760caa14ba782d9df645263560664f01e572d27807ee4f24f90a461d",
"blockNumber": "0xdddeec",
"from": "0x017F8Ad14A2E745ea0F756Bd57CD4852400be78c",
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"cumulativeGasUsed": "0x9d8b3",
"gasUsed": "0x9d8b3",
"contractAddress": "0xD28fbF7569f31877922cDc31a1A5B3C504E8faa1",
"logs": [
{
"address": "0xD28fbF7569f31877922cDc31a1A5B3C504E8faa1",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000017f8ad14a2e745ea0f756bd57cd4852400be78c"
],
"data": "0x",
"blockHash": "0x9dad2d2e760caa14ba782d9df645263560664f01e572d27807ee4f24f90a461d",
"blockNumber": "0xdddeec",
"transactionHash": "0x8e04429d190ad69e9146fff3ecbcd29cf483d8ed1a568e555bc045560a899640",
"transactionIndex": "0x0",
"logIndex": "0x0",
"removed": false
}
],
"status": "0x1",
"logsBloom": "0x04000000000000000000000000000000000010000000000000800000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000400000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000100000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1697136284,
"chain": 5000,
"multi": false,
"commit": "59d48e1"
}
Loading