Skip to content

Commit 49e5ef9

Browse files
adapt to gif-interface changes in release v1.5.0-staging-i and cleanup
1 parent afea190 commit 49e5ef9

File tree

17 files changed

+109
-848
lines changed

17 files changed

+109
-848
lines changed

brownie-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ compiler:
88
runs: 200
99
# https://eth-brownie.readthedocs.io/en/stable/compile.html#compiler-settings
1010
remappings:
11-
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.5.0"
12-
- "@gif-interface=etherisc/gif-interface@1.3.0-staging"
11+
- "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.6.0"
12+
- "@gif-interface=etherisc/gif-interface@1.5.0-staging-i"
1313
vyper:
1414
version: null
1515

@@ -18,8 +18,8 @@ compiler:
1818
# to list the packages installed via the dependency list below
1919
dependencies:
2020
# github dependency format: <owner>/<repository>@<release>
21-
- OpenZeppelin/openzeppelin-contracts@4.5.0
22-
- etherisc/gif-interface@1.3.0-staging
21+
- OpenZeppelin/openzeppelin-contracts@4.6.0
22+
- etherisc/gif-interface@1.5.0-staging-i
2323

2424
# exclude Ownable when calculating test coverage
2525
# https://eth-brownie.readthedocs.io/en/v1.10.3/config.html#exclude_paths

contracts/example/fire/FireInsurance.sol

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// SPDX-License-Identifier: Apache-2.0
22
pragma solidity ^0.8.0;
33

4-
import "@gif-interface/contracts/Product.sol";
54
import "./FireOracle.sol";
6-
5+
import "@gif-interface/contracts/components/Product.sol";
76

87
contract FireInsurance is Product {
98

@@ -25,20 +24,21 @@ contract FireInsurance is Product {
2524
// events
2625
event LogFirePolicyCreated(address policyHolder, string objectName, bytes32 policyId);
2726
event LogFirePolicyExpired(string objectName, bytes32 policyId);
27+
event LogFireOracleCallbackReceived(uint256 requestId, bytes32 policyId, bytes fireCategory);
2828
event LogFireClaimConfirmed(bytes32 policyId, uint256 claimId, uint256 payoutId, uint256 payoutAmount);
2929
event LogFirePayoutExecuted(bytes32 policyId, uint256 claimId, uint256 payoutId, uint256 payoutAmount);
3030

31-
// functions
3231
constructor(
33-
address gifProductService,
3432
bytes32 productName,
33+
address registry,
3534
uint256 oracleId
3635
)
37-
Product(gifProductService, productName, POLICY_FLOW)
36+
Product(productName, POLICY_FLOW, registry)
3837
{
3938
fireOracleId = oracleId;
4039
}
4140

41+
// functions
4242
function deposit() public payable {}
4343

4444
function withdraw(uint256 amount) external onlyOwner {
@@ -64,7 +64,7 @@ contract FireInsurance is Product {
6464

6565
// Create new ID for this policy
6666
uniqueIndex++;
67-
policyId = keccak256(abi.encode(productId, policyHolder, objectName, uniqueIndex));
67+
policyId = keccak256(abi.encode(getId(), policyHolder, objectName, uniqueIndex));
6868

6969
// Create and underwrite new application
7070
_newApplication(policyId, abi.encode(policyHolder, objectName, premium));
@@ -103,6 +103,8 @@ contract FireInsurance is Product {
103103
external
104104
onlyOracle
105105
{
106+
emit LogFireOracleCallbackReceived(requestId, policyId, response);
107+
106108
// Get policy data for oracle response
107109
(address payable policyHolder, string memory objectName, uint256 premium) = abi.decode(
108110
_getApplicationData(policyId), (address, string, uint256));

contracts/example/fire/FireOracle.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
// SPDX-License-Identifier: Apache-2.0
22
pragma solidity ^0.8.0;
33

4-
import "@gif-interface/contracts/Oracle.sol";
5-
4+
import "@gif-interface/contracts/components/Oracle.sol";
65

76
contract FireOracle is Oracle {
87

9-
event LogFireOracleRequest(uint256 requestId, string objectName);
8+
event LogFireOracleRequest(
9+
uint256 requestId,
10+
string objectName
11+
);
1012

1113
constructor(
12-
address gifOracleService,
13-
address gifOracleOwnerService,
14-
bytes32 oracleName
14+
bytes32 oracleName,
15+
address registry
1516
)
16-
Oracle(gifOracleService, gifOracleOwnerService, oracleName)
17+
Oracle(oracleName, registry)
1718
{ }
1819

1920
function request(uint256 requestId, bytes calldata input)

contracts/example/helloworld/HelloWorldInsurance.sol

Lines changed: 0 additions & 156 deletions
This file was deleted.

contracts/example/helloworld/HelloWorldOracle.sol

Lines changed: 0 additions & 68 deletions
This file was deleted.

contracts/example/helloworld/IHelloWorldInsurance.sol

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)