Skip to content

Commit

Permalink
Аdds oz beacon proxy tests (#604)
Browse files Browse the repository at this point in the history
* Adds transparent upgradeable proxy tests

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Removes comment from Box.sol

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Fix PR commits

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Drafts tests for beacon proxy OZ

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Adds negative scenario

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Gets transparent proxy commits and use utils

Signed-off-by: Konstantina Blazhukova <[email protected]>

* Addresses comments

Signed-off-by: Konstantina Blazhukova <[email protected]>

* removes unecessary changes

Signed-off-by: Konstantina Blazhukova <[email protected]>

---------

Signed-off-by: Konstantina Blazhukova <[email protected]>
  • Loading branch information
konstantinabl authored Dec 4, 2023
1 parent adfc479 commit aa23073
Show file tree
Hide file tree
Showing 13 changed files with 728 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/5104ee51b918faba937e8ffccb0f8cc7.json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "LogicContractV1",
"sourceName": "contracts/beacon-proxy/LogicContractV1.sol",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Value",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newValue",
"type": "uint256"
}
],
"name": "ValueChanged",
"type": "event"
},
{
"inputs": [],
"name": "retrieve",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_input",
"type": "uint256"
}
],
"name": "square",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_newValue",
"type": "uint256"
}
],
"name": "store",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506040516101b33803806101b383398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b6101548061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632e64cec1146100465780636057361d146100605780637b29290914610075575b600080fd5b61004e610086565b60405190815260200160405180910390f35b61007361006e366004610105565b6100ca565b005b61004e610083366004610105565b90565b60007f2a27502c345a4cd966daa061d5537f54cd60d2d20b73680b3bf195c91e806a4b6000546040516100bb91815260200190565b60405180910390a15060005490565b60008190556040518181527f93fe6d397c74fdf1402a8b72e47b68512f0510d7b98a4bc4cbdf6ac7108b3c599060200160405180910390a150565b60006020828403121561011757600080fd5b503591905056fea26469706673582212209aeab14fb7a35f692a41ca933ded8ff288c4157f62cb1dc28ea6547f2711585b64736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632e64cec1146100465780636057361d146100605780637b29290914610075575b600080fd5b61004e610086565b60405190815260200160405180910390f35b61007361006e366004610105565b6100ca565b005b61004e610083366004610105565b90565b60007f2a27502c345a4cd966daa061d5537f54cd60d2d20b73680b3bf195c91e806a4b6000546040516100bb91815260200190565b60405180910390a15060005490565b60008190556040518181527f93fe6d397c74fdf1402a8b72e47b68512f0510d7b98a4bc4cbdf6ac7108b3c599060200160405180910390a150565b60006020828403121561011757600080fd5b503591905056fea26469706673582212209aeab14fb7a35f692a41ca933ded8ff288c4157f62cb1dc28ea6547f2711585b64736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/1e690f718d22157ebf8e6a81e57a83f0.json"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "LogicContractV2",
"sourceName": "contracts/beacon-proxy/LogicContractV2.sol",
"abi": [
{
"inputs": [
{
"internalType": "uint256",
"name": "_value",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "squaredValue",
"type": "uint256"
}
],
"name": "Squared",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Value",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "newValue",
"type": "uint256"
}
],
"name": "ValueChanged",
"type": "event"
},
{
"inputs": [],
"name": "retrieve",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_input",
"type": "uint256"
}
],
"name": "square",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_newValue",
"type": "uint256"
}
],
"name": "store",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161022838038061022883398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b6101c98061005f6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632e64cec1146100465780636057361d146100605780637b29290914610075575b600080fd5b61004e610088565b60405190815260200160405180910390f35b61007361006e366004610155565b6100cc565b005b61004e610083366004610155565b610107565b60007f2a27502c345a4cd966daa061d5537f54cd60d2d20b73680b3bf195c91e806a4b6000546040516100bd91815260200190565b60405180910390a15060005490565b60008190556040518181527f93fe6d397c74fdf1402a8b72e47b68512f0510d7b98a4bc4cbdf6ac7108b3c599060200160405180910390a150565b60007fea14d4893872191a028c318d4e480b9683b2e5a8626d2e0f87d8f39cf0b5a9ca610134838061016e565b60405190815260200160405180910390a161014f828061016e565b92915050565b60006020828403121561016757600080fd5b5035919050565b808202811582820484141761014f57634e487b7160e01b600052601160045260246000fdfea2646970667358221220ad592f0a0d4a5d47764f18af2f636e5e4f3c0146bdb41cbfefb39a9252bb53df64736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80632e64cec1146100465780636057361d146100605780637b29290914610075575b600080fd5b61004e610088565b60405190815260200160405180910390f35b61007361006e366004610155565b6100cc565b005b61004e610083366004610155565b610107565b60007f2a27502c345a4cd966daa061d5537f54cd60d2d20b73680b3bf195c91e806a4b6000546040516100bd91815260200190565b60405180910390a15060005490565b60008190556040518181527f93fe6d397c74fdf1402a8b72e47b68512f0510d7b98a4bc4cbdf6ac7108b3c599060200160405180910390a150565b60007fea14d4893872191a028c318d4e480b9683b2e5a8626d2e0f87d8f39cf0b5a9ca610134838061016e565b60405190815260200160405180910390a161014f828061016e565b92915050565b60006020828403121561016757600080fd5b5035919050565b808202811582820484141761014f57634e487b7160e01b600052601160045260246000fdfea2646970667358221220ad592f0a0d4a5d47764f18af2f636e5e4f3c0146bdb41cbfefb39a9252bb53df64736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/8256eb8594b3c9bc7d7a4919b0a016fd.json"
}
151 changes: 151 additions & 0 deletions artifacts/contracts/beacon-proxy/MyBeacon.sol/MyBeacon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "MyBeacon",
"sourceName": "contracts/beacon-proxy/MyBeacon.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "implementation_",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "BeaconInvalidImplementation",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "OwnableInvalidOwner",
"type": "error"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "OwnableUnauthorizedAccount",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b5060405161045638038061045683398101604081905261002f91610169565b8181806001600160a01b03811661006157604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61006a8161007d565b50610074826100cd565b5050505061019c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b806001600160a01b03163b6000036101035760405163211eb15960e21b81526001600160a01b0382166004820152602401610058565b600180546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b038116811461016457600080fd5b919050565b6000806040838503121561017c57600080fd5b6101858361014d565b91506101936020840161014d565b90509250929050565b6102ab806101ab6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a366004610245565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c1366004610245565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101e8565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101e8565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561025757600080fd5b81356001600160a01b038116811461026e57600080fd5b939250505056fea264697066735822122081ad42bc38e400889f4ec6029903eb87402879b8fe9a010eefd8ac7a63d6ab9764736f6c63430008140033",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80633659cfe61461005c5780635c60da1b14610071578063715018a61461009a5780638da5cb5b146100a2578063f2fde38b146100b3575b600080fd5b61006f61006a366004610245565b6100c6565b005b6001546001600160a01b03165b6040516001600160a01b03909116815260200160405180910390f35b61006f6100da565b6000546001600160a01b031661007e565b61006f6100c1366004610245565b6100ee565b6100ce61012e565b6100d78161015b565b50565b6100e261012e565b6100ec60006101e8565b565b6100f661012e565b6001600160a01b03811661012557604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6100d7816101e8565b6000546001600160a01b031633146100ec5760405163118cdaa760e01b815233600482015260240161011c565b806001600160a01b03163b6000036101915760405163211eb15960e21b81526001600160a01b038216600482015260240161011c565b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561025757600080fd5b81356001600160a01b038116811461026e57600080fd5b939250505056fea264697066735822122081ad42bc38e400889f4ec6029903eb87402879b8fe9a010eefd8ac7a63d6ab9764736f6c63430008140033",
"linkReferences": {},
"deployedLinkReferences": {}
}
4 changes: 4 additions & 0 deletions artifacts/contracts/beacon-proxy/MyProxy.sol/MyProxy.dbg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/8256eb8594b3c9bc7d7a4919b0a016fd.json"
}
Loading

0 comments on commit aa23073

Please sign in to comment.