mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-03 14:33:09 +00:00
chore: compile smart contracts and generate types
This commit is contained in:
parent
30422114f6
commit
ab3f21f209
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,3 +1,3 @@
|
||||
[submodule "waku/v2/protocol/rln/contracts/rln-contract"]
|
||||
path = waku/v2/protocol/rln/contracts/rln-contract
|
||||
url = git@github.com:vacp2p/rln-contract.git
|
||||
[submodule "waku/v2/protocol/rln/contracts/waku-rln-contract"]
|
||||
path = waku/v2/protocol/rln/contracts/waku-rln-contract
|
||||
url = git@github.com:waku-org/waku-rln-contract.git
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
### Requirements:
|
||||
- Node.js
|
||||
- Go
|
||||
- jq
|
||||
- [solcjs 0.8.15](https://github.com/ethereum/solc-js)
|
||||
- [abigen](https://github.com/ethereum/go-ethereum/tree/master/cmd/abigen)
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
waku/v2/protocol/rln/contracts/compile_contracts.sh
Executable file
24
waku/v2/protocol/rln/contracts/compile_contracts.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Generate solc_output.json
|
||||
cat import.json | solcjs --bin --standard-json --base-path . > solc_output.json
|
||||
tail -n +2 solc_output.json > solc_output.tmp # Removes ">>> Cannot retry compilation with SMT because there are no SMT solvers available."
|
||||
mv solc_output.tmp solc_output.json
|
||||
|
||||
# Generate abi and binary files for each smart contract
|
||||
jq '.contracts."WakuRln.sol".WakuRln.abi' -r -c solc_output.json > WakuRln.abi
|
||||
jq '.contracts."WakuRln.sol".WakuRln.evm.bytecode.object' -r -c solc_output.json > WakuRln.bin
|
||||
jq '.contracts."WakuRlnRegistry.sol".WakuRlnRegistry.abi' -r -c solc_output.json > WakuRlnRegistry.abi
|
||||
jq '.contracts."WakuRlnRegistry.sol".WakuRlnRegistry.evm.bytecode.object' -r -c solc_output.json > WakuRlnRegistry.bin
|
||||
jq '.contracts."rln-contract/PoseidonHasher.sol".PoseidonHasher.abi' -r -c solc_output.json > PoseidonHasher.abi
|
||||
jq '.contracts."rln-contract/PoseidonHasher.sol".PoseidonHasher.evm.bytecode.object' -r -c solc_output.json > PoseidonHasher.bin
|
||||
|
||||
# Generate golang types for each contract
|
||||
abigen --abi ./WakuRln.abi --pkg contracts --type RLN --out ./rln.go --bin ./WakuRln.bin
|
||||
abigen --abi ./WakuRlnRegistry.abi --pkg contracts --type RLNRegistry --out ./registry.go --bin ./WakuRlnRegistry.bin
|
||||
abigen --abi ./PoseidonHasher.abi --pkg contracts --type PoseidonHasher --out ./poseidon.go --bin ./PoseidonHasher.bin
|
||||
|
||||
# Cleanup
|
||||
rm *.bin
|
||||
rm *.abi
|
||||
rm solc_output.json
|
||||
@ -1,5 +1,3 @@
|
||||
package contracts
|
||||
|
||||
//go:generate solcjs --abi --bin ./rln-contract/contracts/Rln.sol -o ./
|
||||
//go:generate abigen --abi ./rln-contract_contracts_Rln_sol_RLN.abi --pkg contracts --type RLN --out ./RLN.go --bin ./rln-contract_contracts_Rln_sol_RLN.bin
|
||||
//go:generate abigen --abi ./rln-contract_contracts_PoseidonHasher_sol_PoseidonHasher.abi --pkg contracts --type PoseidonHasher --out ./PoseidonHasher.go --bin ./rln-contract_contracts_PoseidonHasher_sol_PoseidonHasher.bin
|
||||
//go:generate ./compile_contracts.sh
|
||||
|
||||
31
waku/v2/protocol/rln/contracts/import.json
Normal file
31
waku/v2/protocol/rln/contracts/import.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"language": "Solidity",
|
||||
"sources": {
|
||||
"WakuRln.sol": {
|
||||
"urls": ["./waku-rln-contract/contracts/WakuRln.sol"]
|
||||
},
|
||||
"WakuRlnRegistry.sol": {
|
||||
"urls": ["./waku-rln-contract/contracts/WakuRlnRegistry.sol"]
|
||||
},
|
||||
"rln-contract/PoseidonHasher.sol": {
|
||||
"urls": [
|
||||
"./waku-rln-contract/lib/rln-contract/contracts/PoseidonHasher.sol"
|
||||
]
|
||||
},
|
||||
"rln-contract/RlnBase.sol": {
|
||||
"urls": ["./waku-rln-contract/lib/rln-contract/contracts/RlnBase.sol"]
|
||||
},
|
||||
"rln-contract/IVerifier.sol": {
|
||||
"urls": ["./waku-rln-contract/lib/rln-contract/contracts/IVerifier.sol"]
|
||||
},
|
||||
"openzeppelin-contracts/contracts/access/Ownable.sol": {
|
||||
"urls": ["./waku-rln-contract/lib/openzeppelin-contracts/contracts/access/Ownable.sol"]
|
||||
},
|
||||
"openzeppelin-contracts/contracts/utils/Context.sol": {
|
||||
"urls": ["./waku-rln-contract/lib/openzeppelin-contracts/contracts/utils/Context.sol"]
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"outputSelection": { "*": { "*": ["abi", "evm.bytecode.object"] } }
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
814
waku/v2/protocol/rln/contracts/registry.go
Normal file
814
waku/v2/protocol/rln/contracts/registry.go
Normal file
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
Subproject commit f99eb2aa0d62bb27631f6ffb4c6161ceb334d2a3
|
||||
1171
waku/v2/protocol/rln/contracts/rln.go
Normal file
1171
waku/v2/protocol/rln/contracts/rln.go
Normal file
File diff suppressed because one or more lines are too long
1
waku/v2/protocol/rln/contracts/waku-rln-contract
Submodule
1
waku/v2/protocol/rln/contracts/waku-rln-contract
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 63a7856eb29f08644d1e963e3edfc2c182469257
|
||||
Loading…
x
Reference in New Issue
Block a user