def setup_method(self): self.web3 = Web3(EthereumTesterProvider()) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.other_address = Address(self.web3.eth.accounts[1]) self.tx = TxManager.deploy(self.web3) self.token1 = DSToken.deploy(self.web3, 'ABC') self.token1.mint(Wad.from_number(1000000)) self.token2 = DSToken.deploy(self.web3, 'DEF')
def test_equals(self): # given token1 = DSToken.deploy(self.web3, 'ABC') token2 = DSToken.deploy(self.web3, 'DEF') token2b = ERC20Token(web3=self.web3, address=token2.address) # expect assert token1 == token1 assert token2 == token2b assert not token1 == token2 assert not token1 == token2b
def setup_method(self): self.web3 = Web3(EthereumTesterProvider()) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.second_address = Address(self.web3.eth.accounts[1]) self.token = DSToken.deploy(self.web3, 'ABC') self.token.mint(Wad(1000000))
def new_sai() -> SaiDeployment: def deploy(web3, contract_name, args=None): contract_factory = web3.eth.contract( abi=json.loads( pkg_resources.resource_string('api.feed', f'abi/{contract_name}.abi')), bytecode=pkg_resources.resource_string('api.feed', f'abi/{contract_name}.bin')) tx_hash = contract_factory.deploy(args=args) receipt = web3.eth.getTransactionReceipt(tx_hash) return receipt['contractAddress'] web3 = Web3(EthereumTesterProvider()) web3.eth.defaultAccount = web3.eth.accounts[0] our_address = Address(web3.eth.defaultAccount) sai = DSToken.deploy(web3, 'SAI') sin = DSToken.deploy(web3, 'SIN') gem = DSToken.deploy(web3, 'ETH') pip = DSValue.deploy(web3) skr = DSToken.deploy(web3, 'SKR') pot = DSVault.deploy(web3) pit = DSVault.deploy(web3) tip = deploy(web3, 'Tip') dad = DSGuard.deploy(web3) jug = deploy(web3, 'SaiJug', [sai.address.address, sin.address.address]) jar = deploy( web3, 'SaiJar', [skr.address.address, gem.address.address, pip.address.address]) tub = Tub.deploy(web3, Address(jar), Address(jug), pot.address, pit.address, Address(tip)) tap = Tap.deploy(web3, tub.address, pit.address) top = Top.deploy(web3, tub.address, tap.address) # set permissions dad.permit(DSGuard.ANY, DSGuard.ANY, DSGuard.ANY) for auth in [sai, sin, skr, pot, pit, tub, tap, top]: auth.set_authority(dad.address) # approve, mint some GEMs tub.approve(directly()) gem.mint(Wad.from_number(1000000)) web3.currentProvider.rpc_methods.evm_snapshot() return SaiDeployment(web3, our_address, gem, sai, skr, tub, tap, top)
def setup_function(): global token token = DSToken.deploy(web3, 'ABC')
def setup_method(self): self.web3 = Web3(EthereumTesterProvider()) self.web3.eth.defaultAccount = self.web3.eth.accounts[0] self.our_address = Address(self.web3.eth.defaultAccount) self.dstoken = DSToken.deploy(self.web3, 'ABC')