Skip to content

Commit

Permalink
Refactor smart contract (#141)
Browse files Browse the repository at this point in the history
* Refactor smart contract

* Code review fixes

* Add onlyOwner modifier

* Code review refactorings
  • Loading branch information
alxkzmn authored Sep 1, 2023
1 parent 90c4242 commit ddc6f08
Show file tree
Hide file tree
Showing 29 changed files with 6,709 additions and 14,515 deletions.
22 changes: 1 addition & 21 deletions backend/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,7 @@ use ethers::prelude::Abigen;
use std::{fs::OpenOptions, io::Write, path::PathBuf};

fn main() {
let contracts = vec![
(
"src/contracts/generated/erc20_balance_retriever.rs",
"ERC20BalanceRetriever",
"ERC20BalanceRetriever",
),
(
"src/contracts/generated/eth_balance_retriever.rs",
"ETHBalanceRetriever",
"ETHBalanceRetriever",
),
(
"src/contracts/generated/evm_address_verifier.rs",
"EVMAddressVerifier",
"EVMAddressVerifier",
),
(
"src/contracts/generated/mock_erc20.rs",
"MockERC20",
"MockERC20",
),
let contracts = [
(
"src/contracts/generated/summa_contract.rs",
"Summa",
Expand Down
4 changes: 2 additions & 2 deletions backend/src/apis/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub async fn fetch_asset_sums<'a, M: Middleware + 'a>(
for contract in &token_contracts {
for addr in exchange_addresses.clone() {
let token_balance = contract.get_token_balance(addr).call().await.unwrap();
sum_token_balance = sum_token_balance + token_balance;
sum_token_balance += token_balance;
}
result.push(sum_token_balance)
}
Expand All @@ -53,7 +53,7 @@ pub async fn fetch_asset_sums<'a, M: Middleware + 'a>(
mod tests {
use super::*;

use crate::contracts::generated::mock_erc20::MockERC20;
use crate::contracts::mock::mock_erc20::MockERC20;
use crate::contracts::tests::initialize_anvil;

#[tokio::test]
Expand Down
1 change: 0 additions & 1 deletion backend/src/contracts/abi/ERC20BalanceRetriever.json

This file was deleted.

1 change: 0 additions & 1 deletion backend/src/contracts/abi/ETHBalanceRetriever.json

This file was deleted.

1 change: 0 additions & 1 deletion backend/src/contracts/abi/EVMAddressVerifier.json

This file was deleted.

1 change: 0 additions & 1 deletion backend/src/contracts/abi/MockERC20.json

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/contracts/abi/Summa.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/src/contracts/deployments.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"31337":{"address":"0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"}}
{ "31337": { "address": "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707" } }
Loading

0 comments on commit ddc6f08

Please sign in to comment.