-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from PeggyJV/bolten/replace-num256
Replace web30 and clarity with ethers-rs
- Loading branch information
Showing
73 changed files
with
6,684 additions
and
2,764 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "abi_build" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
ethers = { version = "0.6.1", features = ["abigen"] } | ||
serde_derive = "1.0" | ||
serde_json = "1.0.69" | ||
serde = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use ethers::contract::Abigen; | ||
use std::process; | ||
|
||
fn main() { | ||
// Gravity contract | ||
|
||
let abigen = match Abigen::new("Gravity", "../gravity_abi/Gravity.json") { | ||
Ok(abigen) => abigen, | ||
Err(e) => { | ||
println!("Could not open Gravity.json: {}", e); | ||
process::exit(1); | ||
} | ||
}; | ||
|
||
let abi = match abigen | ||
.add_event_derive("serde::Deserialize") | ||
.add_event_derive("serde::Serialize") | ||
.generate() | ||
{ | ||
Ok(abi) => abi, | ||
Err(e) => { | ||
println!("Could not generate abi from Gravity.json: {}", e); | ||
process::exit(1); | ||
} | ||
}; | ||
|
||
match abi.write_to_file("../gravity_abi/src/gravity.rs") { | ||
Ok(_) => (), | ||
Err(e) => println!("Error writing gravity.rs: {}", e), | ||
} | ||
|
||
// OpenZeppelin ERC20 contract | ||
|
||
let abigen = match Abigen::new("ERC20", "../gravity_abi/ERC20.json") { | ||
Ok(abigen) => abigen, | ||
Err(e) => { | ||
println!("Could not open ERC20.json: {}", e); | ||
process::exit(1); | ||
} | ||
}; | ||
|
||
let abi = match abigen | ||
.add_event_derive("serde::Deserialize") | ||
.add_event_derive("serde::Serialize") | ||
.generate() | ||
{ | ||
Ok(abi) => abi, | ||
Err(e) => { | ||
println!("Could not generate abi from ERC20.json: {}", e); | ||
process::exit(1); | ||
} | ||
}; | ||
|
||
match abi.write_to_file("../gravity_abi/src/erc20.rs") { | ||
Ok(_) => (), | ||
Err(e) => println!("Error writing erc20.rs: {}", e), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.