Skip to content

Commit

Permalink
Merge branch 'master' into cuong/add_tests_contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
shohamc1 authored Sep 6, 2023
2 parents 3270f0d + 865edf1 commit 25424ce
Show file tree
Hide file tree
Showing 127 changed files with 7,074 additions and 6,113 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ If you’ve found a vulnerability, please submit it privately via `security@defi
We offer a bug bounty of up to **$50,000 USD** worth of DFI for [DeFiCh/ain](https://github.com/defich/ain) critical
vulnerabilities. You must be able to provide significant information for reproducing and fixing the issue.

Only [official releases](https://github.com/DeFiCh/ain/releases), master branch development code are not included.
Bug bounty program is limited to the recent [stable releases](https://github.com/DeFiCh/ain/releases) and it's tags. Any other source origin including `master` branch may not qualify.
1 change: 1 addition & 0 deletions lib/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
unstable_features = true
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
9 changes: 4 additions & 5 deletions lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ jsonrpsee-types = "0.16"
ethereum = "0.14"
ethereum-types = "0.14"
keccak-hash = "0.10"
primitive-types = { version = "0.12", default-features = false, features = ["serde"] }
rlp = "0.5"

ethabi = "18.0.0"

### ain-evm
evm = { version = "0.39", default-features = false, features = ["with-serde"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ clippy:
# cause conflicts across toolchains
.PHONY: fmt-check
fmt-check:
$(CARGO) fmt $(CARGO_MANIFEST_ARG) --all --check 2> >(grep -v -E 'group_imports|unstable_features')
$(CARGO) fmt $(CARGO_MANIFEST_ARG) --all --check 2> >(grep -v -E 'group_imports|unstable_features|imports_granularity')

.PHONY: fmt
fmt:
Expand Down
4 changes: 2 additions & 2 deletions lib/ain-contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
primitive-types.workspace = true
ethereum-types.workspace = true
anyhow.workspace = true
ethereum.workspace = true
serde_json.workspace = true
hex.workspace = true
lazy_static.workspace = true
sha3.workspace = true
sp-core.workspace = true
lazy_static.workspace = true

[build-dependencies]
ethers.workspace = true
Expand Down
19 changes: 15 additions & 4 deletions lib/ain-contracts/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::env;
use std::fs;
use std::path::PathBuf;
use std::{env, fs, path::PathBuf};

use anyhow::format_err;
use ethers_solc::{Project, ProjectPathsConfig, Solc};
Expand All @@ -12,6 +10,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
("dfi_intrinsics", "DFIIntrinsics"),
("dst20", "DST20"),
("system_reserved", "SystemReservedContract"),
("transfer_domain", "TransferDomain"),
];

for (file_path, contract_name) in contracts {
Expand Down Expand Up @@ -39,13 +38,25 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
for (id, artifact) in artifacts {
if id.name == contract_name {
let abi = artifact.abi.ok_or_else(|| format_err!("ABI not found"))?;
let bytecode = artifact.deployed_bytecode.expect("No bytecode found");
let deployed_bytecode = artifact
.deployed_bytecode
.expect("No deployed_bytecode found");

let bytecode = artifact.bytecode.expect("No bytecode found");

fs::create_dir_all(format!("{output_path}/ain_contracts/{file_path}"))?;
fs::write(
PathBuf::from(format!(
"{output_path}/ain_contracts/{file_path}/bytecode.json"
)),
serde_json::to_string(&deployed_bytecode)
.unwrap()
.as_bytes(),
)?;
fs::write(
PathBuf::from(format!(
"{output_path}/ain_contracts/{file_path}/input.json"
)),
serde_json::to_string(&bytecode).unwrap().as_bytes(),
)?;
fs::write(
Expand Down
Loading

0 comments on commit 25424ce

Please sign in to comment.