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

feat: added example to showcase OZ ERC1967Upgrade (#613) #615

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "VoteProxy",
"sourceName": "contracts/solidity/oz/ERC1967Upgrade/VoteProxy.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "implementationContract",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
}
],
"name": "AddressEmptyCode",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "admin",
"type": "address"
}
],
"name": "ERC1967InvalidAdmin",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "ERC1967InvalidImplementation",
"type": "error"
},
{
"inputs": [],
"name": "ERC1967NonPayable",
"type": "error"
},
{
"inputs": [],
"name": "FailedInnerCall",
"type": "error"
},
{
"inputs": [],
"name": "Unauthorized_Caller",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [
{
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "changeAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getAdminSlot",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "getCurrentAdmin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getImplementationSlot",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeToAndCall",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405162000982380380620009828339810160408190526100319161030b565b604080516020810190915260008152819061004c828261005e565b506100589050336100bd565b50610363565b6100678261012c565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156100b1576100ac82826101ab565b505050565b6100b9610222565b5050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6100fe60008051602062000962833981519152546001600160a01b031690565b604080516001600160a01b03928316815291841660208301520160405180910390a161012981610243565b50565b806001600160a01b03163b60000361016757604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6060600080846001600160a01b0316846040516101c89190610334565b600060405180830381855af49150503d8060008114610203576040519150601f19603f3d011682016040523d82523d6000602084013e610208565b606091505b509092509050610219858383610283565b95945050505050565b34156102415760405163b398979f60e01b815260040160405180910390fd5b565b6001600160a01b03811661026d57604051633173bdd160e11b81526000600482015260240161015e565b806000805160206200096283398151915261018a565b60608261029857610293826102e2565b6102db565b81511580156102af57506001600160a01b0384163b155b156102d857604051639996b31560e01b81526001600160a01b038516600482015260240161015e565b50805b9392505050565b8051156102f25780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561031d57600080fd5b81516001600160a01b03811681146102db57600080fd5b6000825160005b81811015610355576020818601810151858301520161033b565b506000920191825250919050565b6105ef80620003736000396000f3fe6080604052600436106100695760003560e01c80637a34c821116100435780637a34c821146100e15780638f2839701461011e5780639ad5c59a1461013e57610070565b8063388e9e0a1461007a5780635c60da1b1461009a578063643d430c146100cc57610070565b3661007057005b610078610171565b005b34801561008657600080fd5b50610078610095366004610561565b610183565b3480156100a657600080fd5b506100af6101da565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d857600080fd5b506100af6101e9565b3480156100ed57600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b6040519081526020016100c3565b34801561012a57600080fd5b50610078610139366004610561565b6101f3565b34801561014a57600080fd5b507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103610110565b61018161017c6101da565b610236565b565b3361018c61025a565b6001600160a01b0316816001600160a01b0316146101bd5760405163235c17e160e11b815260040160405180910390fd5b6101d6826040518060200160405280600081525061028d565b5050565b60006101e46102e8565b905090565b60006101e461025a565b336101fc61025a565b6001600160a01b0316816001600160a01b03161461022d5760405163235c17e160e11b815260040160405180910390fd5b6101d682610310565b3660008037600080366000845af43d6000803e808015610255573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61029682610367565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156102e0576102db82826103f3565b505050565b6101d6610469565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61027e565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61033961025a565b604080516001600160a01b03928316815291841660208301520160405180910390a161036481610488565b50565b806001600160a01b03163b6000036103a257604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905550565b6060600080846001600160a01b031684604051610410919061058a565b600060405180830381855af49150503d806000811461044b576040519150601f19603f3d011682016040523d82523d6000602084013e610450565b606091505b50915091506104608583836104d9565b95945050505050565b34156101815760405163b398979f60e01b815260040160405180910390fd5b6001600160a01b0381166104b257604051633173bdd160e11b815260006004820152602401610399565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036103c5565b6060826104ee576104e982610538565b610531565b815115801561050557506001600160a01b0384163b155b1561052e57604051639996b31560e01b81526001600160a01b0385166004820152602401610399565b50805b9392505050565b8051156105485780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561057357600080fd5b81356001600160a01b038116811461053157600080fd5b6000825160005b818110156105ab5760208186018101518583015201610591565b50600092019182525091905056fea2646970667358221220e075711bc61d4d836d313f5b68b058a00c95d9aa1af3f2455e2516b3d753c68d64736f6c63430008140033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103",
"deployedBytecode": "0x6080604052600436106100695760003560e01c80637a34c821116100435780637a34c821146100e15780638f2839701461011e5780639ad5c59a1461013e57610070565b8063388e9e0a1461007a5780635c60da1b1461009a578063643d430c146100cc57610070565b3661007057005b610078610171565b005b34801561008657600080fd5b50610078610095366004610561565b610183565b3480156100a657600080fd5b506100af6101da565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100d857600080fd5b506100af6101e9565b3480156100ed57600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b6040519081526020016100c3565b34801561012a57600080fd5b50610078610139366004610561565b6101f3565b34801561014a57600080fd5b507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103610110565b61018161017c6101da565b610236565b565b3361018c61025a565b6001600160a01b0316816001600160a01b0316146101bd5760405163235c17e160e11b815260040160405180910390fd5b6101d6826040518060200160405280600081525061028d565b5050565b60006101e46102e8565b905090565b60006101e461025a565b336101fc61025a565b6001600160a01b0316816001600160a01b03161461022d5760405163235c17e160e11b815260040160405180910390fd5b6101d682610310565b3660008037600080366000845af43d6000803e808015610255573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61029682610367565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156102e0576102db82826103f3565b505050565b6101d6610469565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61027e565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61033961025a565b604080516001600160a01b03928316815291841660208301520160405180910390a161036481610488565b50565b806001600160a01b03163b6000036103a257604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905550565b6060600080846001600160a01b031684604051610410919061058a565b600060405180830381855af49150503d806000811461044b576040519150601f19603f3d011682016040523d82523d6000602084013e610450565b606091505b50915091506104608583836104d9565b95945050505050565b34156101815760405163b398979f60e01b815260040160405180910390fd5b6001600160a01b0381166104b257604051633173bdd160e11b815260006004820152602401610399565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036103c5565b6060826104ee576104e982610538565b610531565b815115801561050557506001600160a01b0384163b155b1561052e57604051639996b31560e01b81526001600160a01b0385166004820152602401610399565b50805b9392505050565b8051156105485780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561057357600080fd5b81356001600160a01b038116811461053157600080fd5b6000825160005b818110156105ab5760208186018101518583015201610591565b50600092019182525091905056fea2646970667358221220e075711bc61d4d836d313f5b68b058a00c95d9aa1af3f2455e2516b3d753c68d64736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "VoteV1",
"sourceName": "contracts/solidity/oz/ERC1967Upgrade/VoteV1.sol",
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "Voter_Has_Already_Voted",
"type": "error"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "vote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "voter",
"type": "address"
}
],
"name": "voted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "voters",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506001600055610273806100256000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063350580ea1461005157806354fd4d501461006f578063632a9a5214610080578063aec2ccae1461008a575b600080fd5b6100596100c6565b60405161006691906101c0565b60405180910390f35b600054604051908152602001610066565b610088610128565b005b6100b661009836600461020d565b6001600160a01b031660009081526002602052604090205460ff1690565b6040519015158152602001610066565b6060600180548060200260200160405190810160405280929190818152602001828054801561011e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610100575b5050505050905090565b3360008181526002602052604090205460ff161561015957604051633b1dbd5760e11b815260040160405180910390fd5b506001805480820182557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff1916339081179091556000908152600260205260409020805460ff19169091179055565b6020808252825182820181905260009190848201906040850190845b818110156102015783516001600160a01b0316835292840192918401916001016101dc565b50909695505050505050565b60006020828403121561021f57600080fd5b81356001600160a01b038116811461023657600080fd5b939250505056fea2646970667358221220f6556c6dad22db499a7dba3e6368615ec9614b8fe420a0af27407d67738a632c64736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063350580ea1461005157806354fd4d501461006f578063632a9a5214610080578063aec2ccae1461008a575b600080fd5b6100596100c6565b60405161006691906101c0565b60405180910390f35b600054604051908152602001610066565b610088610128565b005b6100b661009836600461020d565b6001600160a01b031660009081526002602052604090205460ff1690565b6040519015158152602001610066565b6060600180548060200260200160405190810160405280929190818152602001828054801561011e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610100575b5050505050905090565b3360008181526002602052604090205460ff161561015957604051633b1dbd5760e11b815260040160405180910390fd5b506001805480820182557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff1916339081179091556000908152600260205260409020805460ff19169091179055565b6020808252825182820181905260009190848201906040850190845b818110156102015783516001600160a01b0316835292840192918401916001016101dc565b50909695505050505050565b60006020828403121561021f57600080fd5b81356001600160a01b038116811461023657600080fd5b939250505056fea2646970667358221220f6556c6dad22db499a7dba3e6368615ec9614b8fe420a0af27407d67738a632c64736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Loading
Loading