Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ services:
working_dir: /home/parity

ganache:
image: trufflesuite/ganache-cli:v6.9.1
image: trufflesuite/ganache-cli:v6.12.2
container_name: ganache
ports:
- "8555:8555"
expose:
- "8555"
command: "--gasLimit 10000000
-p 8555
-p 8555 --blockTime 1
--account=\"0x91cf2cc3671a365fcbf38010ff97ee31a5b7e674842663c56769e41600696ead,1000000000000000000000000\"
--account=\"0xc0a550404067ce46a51283e0cc99ec3ba832940064587147a8db9a7ba355ef27,1000000000000000000000000\",
--account=\"0x6ca1cfaba9715aa485504cb8a3d3fe54191e0991b5f47eb982e8fb40d1b8e8d8,1000000000000000000000000\",
Expand Down
343 changes: 166 additions & 177 deletions pymaker/__init__.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pymaker/collateral.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ def approve(self, usr: Address, **kwargs):
Args
usr: User making transactions with this collateral
"""
gas_price = kwargs['gas_price'] if 'gas_price' in kwargs else DefaultGasPrice()
self.adapter.approve(hope_directly(from_address=usr, gas_price=gas_price), self.vat.address)
self.adapter.approve_token(directly(from_address=usr, gas_price=gas_price))
gas_strategy = kwargs['gas_strategy'] if 'gas_strategy' in kwargs else DefaultGasPrice()
self.adapter.approve(hope_directly(from_address=usr, gas_strategy=gas_strategy), self.vat.address)
self.adapter.approve_token(directly(from_address=usr, gas_strategy=gas_strategy))
19 changes: 9 additions & 10 deletions pymaker/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import json
import os
import re
import time
import warnings
from typing import Dict, List, Optional

import pkg_resources
from pymaker.auctions import Clipper, Flapper, Flipper, Flopper
from web3 import Web3, HTTPProvider

from pymaker import Address
from pymaker import Address, Contract
from pymaker.approval import directly, hope_directly
from pymaker.auth import DSGuard
from pymaker.etherdelta import EtherDelta
Expand All @@ -46,6 +48,8 @@


def deploy_contract(web3: Web3, contract_name: str, args: Optional[list] = None) -> Address:
warnings.warn("DEPRECATED: Please subclass Contract and call Contract._deploy instead.",
category=DeprecationWarning, stacklevel=2)
"""Deploys a new contract.

Args:
Expand All @@ -62,12 +66,7 @@ def deploy_contract(web3: Web3, contract_name: str, args: Optional[list] = None)

abi = json.loads(pkg_resources.resource_string('pymaker.deployment', f'abi/{contract_name}.abi'))
bytecode = str(pkg_resources.resource_string('pymaker.deployment', f'abi/{contract_name}.bin'), 'utf-8')
if args is not None:
tx_hash = web3.eth.contract(abi=abi, bytecode=bytecode).constructor(*args).transact()
else:
tx_hash = web3.eth.contract(abi=abi, bytecode=bytecode).constructor().transact()
receipt = web3.eth.getTransactionReceipt(tx_hash)
return Address(receipt['contractAddress'])
return Contract._deploy(web3, abi, bytecode, args if args else [])


class Deployment:
Expand Down Expand Up @@ -383,10 +382,10 @@ def approve_dai(self, usr: Address, **kwargs):
"""
assert isinstance(usr, Address)

gas_price = kwargs['gas_price'] if 'gas_price' in kwargs else DefaultGasPrice()
self.dai_adapter.approve(approval_function=hope_directly(from_address=usr, gas_price=gas_price),
gas_strategy = kwargs['gas_strategy'] if 'gas_strategy' in kwargs else DefaultGasPrice()
self.dai_adapter.approve(approval_function=hope_directly(from_address=usr, gas_strategy=gas_strategy),
source=self.vat.address)
self.dai.approve(self.dai_adapter.address).transact(from_address=usr, gas_price=gas_price)
self.dai.approve(self.dai_adapter.address).transact(from_address=usr, gas_strategy=gas_strategy)

def active_auctions(self) -> dict:
flips = {}
Expand Down
Loading