diff --git a/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol b/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol index e3df9acb..7a6010bd 100644 --- a/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol +++ b/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol @@ -407,6 +407,7 @@ abstract contract Entropy is IEntropy, EntropyState { IEntropyConsumer(callAddress)._entropyCallback( sequenceNumber, + provider, randomNumber ); } diff --git a/target_chains/ethereum/contracts/contracts/entropy/EntropyUpgradable.sol b/target_chains/ethereum/contracts/contracts/entropy/EntropyUpgradable.sol index 8910885e..5cee135b 100644 --- a/target_chains/ethereum/contracts/contracts/entropy/EntropyUpgradable.sol +++ b/target_chains/ethereum/contracts/contracts/entropy/EntropyUpgradable.sol @@ -105,6 +105,6 @@ contract EntropyUpgradable is } function version() public pure returns (string memory) { - return "0.2.0"; + return "0.3.0"; } } diff --git a/target_chains/ethereum/contracts/forge-test/Entropy.t.sol b/target_chains/ethereum/contracts/forge-test/Entropy.t.sol index f888b3fc..62033c98 100644 --- a/target_chains/ethereum/contracts/forge-test/Entropy.t.sol +++ b/target_chains/ethereum/contracts/forge-test/Entropy.t.sol @@ -834,6 +834,7 @@ contract EntropyTest is Test, EntropyTestUtils, EntropyEvents { ); assertEq(consumer.sequence(), assignedSequenceNumber); + assertEq(consumer.provider(), provider1); assertEq( consumer.randomness(), random.combineRandomValues( @@ -893,6 +894,7 @@ contract EntropyConsumer is IEntropyConsumer { uint64 public sequence; bytes32 public randomness; address public entropy; + address public provider; constructor(address _entropy) { entropy = _entropy; @@ -913,9 +915,11 @@ contract EntropyConsumer is IEntropyConsumer { function entropyCallback( uint64 _sequence, + address _provider, bytes32 _randomness ) internal override { sequence = _sequence; + provider = _provider; randomness = _randomness; } } @@ -935,6 +939,7 @@ contract EntropyConsumerFails is IEntropyConsumer { function entropyCallback( uint64 _sequence, + address _provider, bytes32 _randomness ) internal override { revert("Callback failed"); diff --git a/target_chains/ethereum/entropy_sdk/solidity/IEntropyConsumer.sol b/target_chains/ethereum/entropy_sdk/solidity/IEntropyConsumer.sol index a726b780..8cad3e88 100644 --- a/target_chains/ethereum/entropy_sdk/solidity/IEntropyConsumer.sol +++ b/target_chains/ethereum/entropy_sdk/solidity/IEntropyConsumer.sol @@ -5,12 +5,16 @@ abstract contract IEntropyConsumer { // This method is called by Entropy to provide the random number to the consumer. // It asserts that the msg.sender is the Entropy contract. It is not meant to be // override by the consumer. - function _entropyCallback(uint64 sequence, bytes32 randomNumber) external { + function _entropyCallback( + uint64 sequence, + address provider, + bytes32 randomNumber + ) external { address entropy = getEntropy(); require(entropy != address(0), "Entropy address not set"); require(msg.sender == entropy, "Only Entropy can call this function"); - entropyCallback(sequence, randomNumber); + entropyCallback(sequence, provider, randomNumber); } // getEntropy returns Entropy contract address. The method is being used to check that the @@ -23,6 +27,7 @@ abstract contract IEntropyConsumer { // indeed from Entropy contract. function entropyCallback( uint64 sequence, + address provider, bytes32 randomNumber ) internal virtual; } diff --git a/target_chains/ethereum/entropy_sdk/solidity/abis/IEntropyConsumer.json b/target_chains/ethereum/entropy_sdk/solidity/abis/IEntropyConsumer.json index 0bc18b82..4e7cc922 100644 --- a/target_chains/ethereum/entropy_sdk/solidity/abis/IEntropyConsumer.json +++ b/target_chains/ethereum/entropy_sdk/solidity/abis/IEntropyConsumer.json @@ -6,6 +6,11 @@ "name": "sequence", "type": "uint64" }, + { + "internalType": "address", + "name": "provider", + "type": "address" + }, { "internalType": "bytes32", "name": "randomNumber", diff --git a/target_chains/ethereum/entropy_sdk/solidity/package.json b/target_chains/ethereum/entropy_sdk/solidity/package.json index 1e2eb35d..d2eab3f5 100644 --- a/target_chains/ethereum/entropy_sdk/solidity/package.json +++ b/target_chains/ethereum/entropy_sdk/solidity/package.json @@ -1,6 +1,6 @@ { "name": "@pythnetwork/entropy-sdk-solidity", - "version": "1.2.0", + "version": "1.3.0", "description": "Generate secure random numbers with Pyth Entropy", "repository": { "type": "git",