CRYPTO NEWS

Istanbul Blockchain Week founder Erhan Korhaliller discusses why Turkey is one of the hottest places for crypto

CryptoSlate had the opportunity to sit down with Erhan Korhaliller, Founder & CEO of EAK Digital, the web3 communications and events agency behind some of the industry’s most creative IRL events, as he puts plans together for the much anticipated Istanbul Blockchain Week.

The post Istanbul Blockchain Week founder Erhan Korhaliller discusses why Turkey is one of the hottest places for crypto appeared first on CryptoSlate.

Override mock contracts’s address in test

I have a smart contract that is dependent on a pre-deployed ERC-20 smart contract that is always deployed to the same address (in the local test network as well as public ones). I want to override the address of a mock smart contract to be the same as that address, but documentation doesn’t provide any::Listen

I have a smart contract that is dependent on a pre-deployed ERC-20 smart contract that is always deployed to the same address (in the local test network as well as public ones).

I want to override the address of a mock smart contract to be the same as that address, but documentation doesn’t provide any insight.

So the example smart contract I’m experimenting with is rudimentary example from the documentation:

pragma solidity ^0.6.2;  interface IERC20 {     function balanceOf(address account) external view returns (uint256); }  contract AmIRichAlready {     IERC20 private tokenContract;     uint public richness = 1000000 * 10 ** 18;      constructor (IERC20 _tokenContract) public {         tokenContract = _tokenContract;     }      function check() public view returns (bool) {         uint balance = tokenContract.balanceOf(msg.sender);         return balance > richness;     } } 

And the test setup is as follows:

import { expect, use } from "chai" import { Contract, utils, Wallet } from "ethers" import {   deployContract,   deployMockContract,   MockProvider,   solidity, } from "ethereum-waffle"  import IERC20 from "../build/IERC20.json" import AmIRichAlready from "../build/AmIRichAlready.json"  use(solidity)  describe("Am I Rich Already", () => {   let mockERC20: Contract   let contract: Contract   let wallet: Wallet    beforeEach(async () => {     ;[wallet] = new MockProvider().getWallets()     mockERC20 = await deployMockContract(wallet, IERC20.abi)     contract = await deployContract(wallet, AmIRichAlready, [mockERC20.address])   }) }) 

So I’d like to assign a certain address for the mockERC20, so that calling a method at that address will be handled by the mock smart contract.

I’ve tried digging through the source code, but no luck so far. Does anyone have any clue wether or not this is even possible?

Istanbul Blockchain Week founder Erhan Korhaliller discusses why Turkey is one of the hottest places for crypto

Shopping cart
There are no products in the cart!
Continue shopping
0