-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checks for sufficient balances after uploading a csv (#54)
* warn about insufficient balance for the transfer * new util methods to ** create summary map covering all transfers ** check for sufficient balances of all tokens in a summary map This commit is the first to use the web3 connection using the SafeProvider. We do not need an Infuria key anymore because we connect with the SafeProvider. Todo: Tests Small changes: * Header placement and gap between multiple warnings * add testcases * testcase for creating transfer summary * testcase for invalid csvs for 100% coverage on parser.ts * Fix linter error * fixe review issues * comparing balances in wei to avoid precision loss * some format issues / tiny refactorings * handle errors while fetching balance for erc20 * Errors are logged and balances are returned as invalid (-1) Important change: * typings for our web3 calls using TypeChain project * types are generated in postinstall yarn script Co-authored-by: schmanu <[email protected]>
- Loading branch information
Showing
9 changed files
with
391 additions
and
25 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -25,3 +25,6 @@ yarn-error.log* | |
|
||
#vscode environment | ||
/.vscode | ||
|
||
# auto-generated code | ||
/src/contracts |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import IERC20 from "@openzeppelin/contracts/build/contracts/IERC20.json"; | ||
import { ethers } from "ethers"; | ||
|
||
export const erc20Interface = new ethers.utils.Interface(IERC20.abi); | ||
import { IERC20, IERC20__factory } from "./contracts"; | ||
|
||
export const erc20Interface = IERC20__factory.createInterface(); | ||
|
||
export function erc20Instance( | ||
address: string, | ||
provider: ethers.providers.Provider | ||
): ethers.Contract { | ||
return new ethers.Contract(address, erc20Interface, provider); | ||
): IERC20 { | ||
return IERC20__factory.connect(address, provider); | ||
} |
Oops, something went wrong.