Skip to content

Commit eecf76b

Browse files
add crop handling to app readme
1 parent 4c650ea commit eecf76b

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,10 @@
3737
"security.olympix.project.includePath": "/contracts",
3838
"solidity.defaultCompiler": "localFile",
3939
"solidity.compileUsingLocalVersion": "/workspaces/gif-next/soljson-v0.8.26+commit.8a97fa7a.js",
40+
"wake.compiler.solc.remappings": [
41+
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
42+
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
43+
"forge-std/=lib/forge-std/src/",
44+
"@gif-next=contracts/"
45+
],
4046
}

app/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@ from web3utils.contract import Contract
2121
from web3utils.wallet import Wallet
2222
from web3utils.chain import Chain
2323

24-
load_dotenv("../.env")
24+
load_dotenv("./.env")
2525

2626
# get w3 provider/node
2727
w3_uri = os.getenv("NETWORK_URL")
2828
w3 = Web3(Web3.HTTPProvider(w3_uri))
2929
chain = Chain(w3)
30+
31+
# check network connection
32+
assert chain.id() == 80002, f"Not Polygon Amoy. Chain ID {chain.id()}, expected 80002"
3033
assert chain.id() == 8453, f"Not Base Mainnet. Chain ID {chain.id()}, expected 8453"
3134

32-
# get flight contracts
35+
# get crop contract
36+
(product, usdc, instance, admin, reader, registry) = from_product(w3, "CropProduct", os.getenv("PRODUCT_CONTRACT_ADDRESS"))
37+
pool = pool_for_product(registry, reader, product, "CropPool")
38+
39+
# get flight contract
3340
(product, usdc, instance, admin, reader, registry) = from_product(w3, "FlightProduct", os.getenv("FLIGHT_PRODUCT_ADDRESS"))
3441
pool = pool_for_product(registry, reader, product, "FlightPool")
3542
pool_nft = pool.getNftId()

app/web3utils/wallet.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ def transfer(self, to: Union [str, "Wallet"], amount: int, gas_price: int = None
7171
to = to.address
7272

7373
nonce = self.nonce()
74+
chain_id = self.w3.eth.chain_id
7475
gas = 21000
7576
gas_price = gas_price or self.w3.eth.gas_price
7677

7778
tx = {
7879
"to": to,
7980
"value": amount,
8081
"nonce": nonce,
82+
"chainId": chain_id, # only replay-protected (EIP-155) transactions allowed over RPC
8183
"gas": gas,
8284
"gasPrice": gas_price,
8385
}

0 commit comments

Comments
 (0)