Skip to content

Commit 9fe94f9

Browse files
committed
Update OZ version, update token address
1 parent 3f81cb9 commit 9fe94f9

File tree

7 files changed

+19
-6
lines changed

7 files changed

+19
-6
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ yarn install
1616

1717
## Testing
1818

19+
To run integrations test with `starknet-devent`, run `starknet-devnet --seed 0` in another terminal.
20+
Use `starknet-devnet>=0.4.0`
21+
1922
```
2023
yarn test
2124
```
@@ -38,4 +41,4 @@ Copy the resulting seed, public key and address to an `.env` file
3841
| ------- | ----- | ------ | ------------------------------------------------------------------ |
3942
| Mainnet | Ether | ETH | 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 |
4043
| Goerli1 | Ether | ETH | 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 |
41-
| Devnet | Ether | ETH | 0x062230ea046a9a5fbc261ac77d03c8d41e5d442db2284587570ab46455fd2488 |
44+
| Devnet | Ether | ETH | 0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7 |

contracts/Account.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts for Cairo v0.5.0 (account/presets/Account.cairo)
2+
// OpenZeppelin Contracts for Cairo v0.5.1 (account/presets/Account.cairo)
33

44
%lang starknet
55

contracts/account/library.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// OpenZeppelin Contracts for Cairo v0.5.0 (account/library.cairo)
2+
// OpenZeppelin Contracts for Cairo v0.5.1 (account/library.cairo)
33

44
%lang starknet
55

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dotenv": "^10.0.0",
2020
"ethers": "^5.4.7",
2121
"starknet": "^4.12.0",
22-
"starkscan": "^0.0.6"
22+
"starkscan": "^0.0.9"
2323
},
2424
"devDependencies": {
2525
"@types/node": "^16.9.2",

scripts/deploy-prefunded.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Example of a script which:
2+
// Computes the future address of an account
3+
// Transfers some funds into the account
4+
// Deploys the account at the new address with the DEPLOY_ACCOUNT tx
5+
16
import { StarkNetWallet } from "../src/StarkNetWallet";
27
import { getProvider } from "../src/ProviderConfig";
38
import { utils } from "ethers";

scripts/deploy.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Example of a deploy script that will soon be deprecated
2+
13
import { StarkNetWallet } from "../src/StarkNetWallet";
24
import { getProvider } from "../src/ProviderConfig";
35

src/StarkNetWallet.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dotenv.config();
1111

1212
// TODO: calculate this
1313
const ACCOUNT_CLASS_HASH = "0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
14+
const DEFAULT_TOKEN_ADDRESS = "0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";
1415

1516
export class StarkNetWallet {
1617
public account: Account;
@@ -77,7 +78,7 @@ export class StarkNetWallet {
7778

7879
static async getBalance(address: string, provider: ProviderInterface, tokenAddress?: string): Promise<BigNumber> {
7980
if (tokenAddress == null) {
80-
tokenAddress = ensureEnvVar("TOKEN_ADDRESS"); // todo: move to config per chain
81+
tokenAddress = DEFAULT_TOKEN_ADDRESS;
8182
}
8283
const erc20ABI = json.parse(fs.readFileSync("./src/interfaces/ERC20_abi.json").toString("ascii"));
8384
const erc20 = new Contract(erc20ABI, tokenAddress, provider);
@@ -177,7 +178,7 @@ export class StarkNetWallet {
177178

178179
async transfer(recipientAddress: string, amount: BigNumber, tokenAddress?: string, decimals: number = 18) {
179180
if (tokenAddress == null) {
180-
tokenAddress = ensureEnvVar("TOKEN_ADDRESS");
181+
tokenAddress = DEFAULT_TOKEN_ADDRESS;
181182
}
182183

183184
const erc20ABI = json.parse(fs.readFileSync("./src/interfaces/ERC20_abi.json").toString("ascii"));
@@ -248,6 +249,8 @@ export class StarkNetWallet {
248249
calldata: this.toRawCallData(calldata),
249250
};
250251

252+
console.log("Call", call);
253+
251254
let estimateFee = await this.account.estimateInvokeFee(call);
252255
prettyPrintFee(estimateFee);
253256

0 commit comments

Comments
 (0)