-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
remove oracle withdraw and allow contract owner to withdraw #11551
Changes from 2 commits
11ff2f5
e456aac
b3c1d09
54a523e
94b1d53
6b4b478
279fec7
3a7a000
14f4877
a319513
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
echo " ┌──────────────────────────────────────────────┐" | ||
echo " │ Compiling VRF contracts... │" | ||
echo " └──────────────────────────────────────────────┘" | ||
|
||
SOLC_VERSION="0.8.6" | ||
OPTIMIZE_RUNS=1000000 | ||
|
||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )" | ||
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt | ||
|
||
solc-select install $SOLC_VERSION | ||
solc-select use $SOLC_VERSION | ||
export SOLC_VERSION=$SOLC_VERSION | ||
|
||
compileContract () { | ||
local contract | ||
contract=$(basename "$1" ".sol") | ||
|
||
solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \ | ||
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ | ||
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\ | ||
"$ROOT"/contracts/src/v0.8/"$1" | ||
} | ||
|
||
compileContractAltOpts () { | ||
local contract | ||
contract=$(basename "$1" ".sol") | ||
|
||
solc @openzeppelin/="$ROOT"/contracts/node_modules/@openzeppelin/ --overwrite --optimize --optimize-runs "$2" --metadata-hash none \ | ||
-o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ | ||
--abi --bin --allow-paths "$ROOT"/contracts/src/v0.8,"$ROOT"/contracts/node_modules\ | ||
"$ROOT"/contracts/src/v0.8/"$1" | ||
} | ||
|
||
# VRF V2Plus | ||
compileContract vrf/dev/interfaces/IVRFCoordinatorV2PlusInternal.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusConsumerExample.sol | ||
compileContractAltOpts vrf/dev/VRFCoordinatorV2_5.sol 50 | ||
compileContract vrf/dev/BatchVRFCoordinatorV2Plus.sol | ||
compileContract vrf/dev/VRFV2PlusWrapper.sol | ||
compileContract vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol | ||
compileContract vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusExternalSubOwnerExample.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusSingleConsumerExample.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusRevertingExample.sol | ||
compileContract vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol | ||
compileContract vrf/dev/libraries/VRFV2PlusClient.sol | ||
compileContract vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol | ||
compileContract vrf/dev/BlockhashStore.sol | ||
compileContract vrf/dev/TrustedBlockhashStore.sol | ||
compileContract vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol | ||
compileContractAltOpts vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol 5 | ||
compileContract vrf/dev/testhelpers/VRFV2PlusWrapperLoadTestConsumer.sol |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package gethwrappers | ||
|
||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.abi ../../contracts/solc/v0.8.6/BlockhashStore/BlockhashStore.bin BlockhashStore blockhash_store | ||
|
||
// VRF V2Plus | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/IVRFCoordinatorV2PlusInternal/IVRFCoordinatorV2PlusInternal.abi ../../contracts/solc/v0.8.6/IVRFCoordinatorV2PlusInternal/IVRFCoordinatorV2PlusInternal.bin IVRFCoordinatorV2PlusInternal vrf_coordinator_v2plus_interface | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.abi ../../contracts/solc/v0.8.6/BatchVRFCoordinatorV2Plus/BatchVRFCoordinatorV2Plus.bin BatchVRFCoordinatorV2Plus batch_vrf_coordinator_v2plus | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/TrustedBlockhashStore/TrustedBlockhashStore.abi ../../contracts/solc/v0.8.6/TrustedBlockhashStore/TrustedBlockhashStore.bin TrustedBlockhashStore trusted_blockhash_store | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusConsumerExample/VRFV2PlusConsumerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusConsumerExample/VRFV2PlusConsumerExample.bin VRFV2PlusConsumerExample vrfv2plus_consumer_example | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFCoordinatorV2_5/VRFCoordinatorV2_5.abi ../../contracts/solc/v0.8.6/VRFCoordinatorV2_5/VRFCoordinatorV2_5.bin VRFCoordinatorV2_5 vrf_coordinator_v2_5 | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusWrapper/VRFV2PlusWrapper.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapper/VRFV2PlusWrapper.bin VRFV2PlusWrapper vrfv2plus_wrapper | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusWrapperConsumerExample/VRFV2PlusWrapperConsumerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapperConsumerExample/VRFV2PlusWrapperConsumerExample.bin VRFV2PlusWrapperConsumerExample vrfv2plus_wrapper_consumer_example | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFMaliciousConsumerV2Plus/VRFMaliciousConsumerV2Plus.abi ../../contracts/solc/v0.8.6/VRFMaliciousConsumerV2Plus/VRFMaliciousConsumerV2Plus.bin VRFMaliciousConsumerV2Plus vrf_malicious_consumer_v2_plus | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusSingleConsumerExample/VRFV2PlusSingleConsumerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusSingleConsumerExample/VRFV2PlusSingleConsumerExample.bin VRFV2PlusSingleConsumerExample vrf_v2plus_single_consumer | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusExternalSubOwnerExample/VRFV2PlusExternalSubOwnerExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusExternalSubOwnerExample/VRFV2PlusExternalSubOwnerExample.bin VRFV2PlusExternalSubOwnerExample vrf_v2plus_sub_owner | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusRevertingExample/VRFV2PlusRevertingExample.abi ../../contracts/solc/v0.8.6/VRFV2PlusRevertingExample/VRFV2PlusRevertingExample.bin VRFV2PlusRevertingExample vrfv2plus_reverting_example | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFConsumerV2PlusUpgradeableExample/VRFConsumerV2PlusUpgradeableExample.abi ../../contracts/solc/v0.8.6/VRFConsumerV2PlusUpgradeableExample/VRFConsumerV2PlusUpgradeableExample.bin VRFConsumerV2PlusUpgradeableExample vrf_consumer_v2_plus_upgradeable_example | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusClient/VRFV2PlusClient.abi ../../contracts/solc/v0.8.6/VRFV2PlusClient/VRFV2PlusClient.bin VRFV2PlusClient vrfv2plus_client | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFCoordinatorV2Plus_V2Example/VRFCoordinatorV2Plus_V2Example.abi ../../contracts/solc/v0.8.6/VRFCoordinatorV2Plus_V2Example/VRFCoordinatorV2Plus_V2Example.bin VRFCoordinatorV2Plus_V2Example vrf_coordinator_v2_plus_v2_example | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusMaliciousMigrator/VRFV2PlusMaliciousMigrator.abi ../../contracts/solc/v0.8.6/VRFV2PlusMaliciousMigrator/VRFV2PlusMaliciousMigrator.bin VRFV2PlusMaliciousMigrator vrfv2plus_malicious_migrator | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusLoadTestWithMetrics/VRFV2PlusLoadTestWithMetrics.abi ../../contracts/solc/v0.8.6/VRFV2PlusLoadTestWithMetrics/VRFV2PlusLoadTestWithMetrics.bin VRFV2PlusLoadTestWithMetrics vrf_v2plus_load_test_with_metrics | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFCoordinatorV2PlusUpgradedVersion/VRFCoordinatorV2PlusUpgradedVersion.abi ../../contracts/solc/v0.8.6/VRFCoordinatorV2PlusUpgradedVersion/VRFCoordinatorV2PlusUpgradedVersion.bin VRFCoordinatorV2PlusUpgradedVersion vrf_v2plus_upgraded_version | ||
//go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/VRFV2PlusWrapperLoadTestConsumer/VRFV2PlusWrapperLoadTestConsumer.abi ../../contracts/solc/v0.8.6/VRFV2PlusWrapperLoadTestConsumer/VRFV2PlusWrapperLoadTestConsumer.bin VRFV2PlusWrapperLoadTestConsumer vrfv2plus_wrapper_load_test_consumer |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ type CoordinatorV2_X interface { | |
GetConfig(opts *bind.CallOpts) (Config, error) | ||
ParseLog(log types.Log) (generated.AbigenLog, error) | ||
OracleWithdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) | ||
Withdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) | ||
Withdraw(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a second method here for withdrawing native? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we can add it for completeness. It seems that Withdraw() isn't used anywhere currently either There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In terms of test coverage, withdrawNative is tested in integration tests which uses a different interface from this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this interface is not tested or is just the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The interface is used and tested but seems that a few methods ( The integration tests use different interface but I'm not sure if we have a good reason for it. I think we have room for some refactoring in integration tests to either create a new shared interface for v2 and v2plus or use the existing one above. |
||
LogsWithTopics(keyHash common.Hash) map[common.Hash][][]log.Topic | ||
Version() vrfcommon.Version | ||
RegisterProvingKey(opts *bind.TransactOpts, oracle *common.Address, publicProvingKey [2]*big.Int) (*types.Transaction, error) | ||
|
@@ -131,7 +131,7 @@ func (c *coordinatorV2) OracleWithdraw(opts *bind.TransactOpts, recipient common | |
return c.coordinator.OracleWithdraw(opts, recipient, amount) | ||
} | ||
|
||
func (c *coordinatorV2) Withdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { | ||
func (c *coordinatorV2) Withdraw(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error) { | ||
return nil, errors.New("withdraw not implemented for v2") | ||
} | ||
|
||
|
@@ -289,8 +289,8 @@ func (c *coordinatorV2_5) OracleWithdraw(opts *bind.TransactOpts, recipient comm | |
return nil, errors.New("oracle withdraw not implemented for v2.5") | ||
} | ||
|
||
func (c *coordinatorV2_5) Withdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { | ||
return c.coordinator.Withdraw(opts, recipient, amount) | ||
func (c *coordinatorV2_5) Withdraw(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error) { | ||
return c.coordinator.Withdraw(opts, recipient) | ||
} | ||
|
||
func (c *coordinatorV2_5) LogsWithTopics(keyHash common.Hash) map[common.Hash][][]log.Topic { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed? this is already in https://github.com/smartcontractkit/chainlink/blob/develop/contracts/scripts/native_solc_compile_all_vrf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the naming convention here is defined here . I don't think maintaining a separate foundry profile (e.g. vrfv2plus) is needed