Skip to content

Commit

Permalink
tweak: asset -> isAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
alcueca committed May 25, 2021
1 parent 1c2b105 commit 12f107b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
28 changes: 14 additions & 14 deletions contracts/Ladle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ contract Ladle is LadleStorage, AccessControl() {
(cachedId, vault) = (vaultId, _build(vaultId, seriesId, ilkId)); // Cache the vault that was just built

} else if (operation == Operation.FORWARD_PERMIT) {
(bytes6 id, bool asset, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) =
(bytes6 id, bool isAsset, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) =
abi.decode(data[i], (bytes6, bool, address, uint256, uint256, uint8, bytes32, bytes32));
_forwardPermit(id, asset, spender, amount, deadline, v, r, s);
_forwardPermit(id, isAsset, spender, amount, deadline, v, r, s);

} else if (operation == Operation.JOIN_ETHER) {
(bytes6 etherId) = abi.decode(data[i], (bytes6));
Expand All @@ -159,9 +159,9 @@ contract Ladle is LadleStorage, AccessControl() {
(vault,) = _roll(vaultId, vault, newSeriesId, max);

} else if (operation == Operation.FORWARD_DAI_PERMIT) {
(bytes6 id, bool asset, address spender, uint256 nonce, uint256 deadline, bool allowed, uint8 v, bytes32 r, bytes32 s) =
(bytes6 id, bool isAsset, address spender, uint256 nonce, uint256 deadline, bool allowed, uint8 v, bytes32 r, bytes32 s) =
abi.decode(data[i], (bytes6, bool, address, uint256, uint256, bool, uint8, bytes32, bytes32));
_forwardDaiPermit(id, asset, spender, nonce, deadline, allowed, v, r, s);
_forwardDaiPermit(id, isAsset, spender, nonce, deadline, allowed, v, r, s);

} else if (operation == Operation.TRANSFER_TO_POOL) {
(bytes6 seriesId, bool base, uint128 wad) =
Expand Down Expand Up @@ -200,8 +200,8 @@ contract Ladle is LadleStorage, AccessControl() {
_repayLadle(vaultId, vault);

} else if (operation == Operation.RETRIEVE) {
(bytes6 assetId, bool asset, address to) = abi.decode(data[i], (bytes6, bool, address));
_retrieve(assetId, asset, to);
(bytes6 assetId, bool isAsset, address to) = abi.decode(data[i], (bytes6, bool, address));
_retrieve(assetId, isAsset, to);

} else if (operation == Operation.TRANSFER_TO_FYTOKEN) {
(bytes6 seriesId, uint256 amount) = abi.decode(data[i], (bytes6, uint256));
Expand Down Expand Up @@ -488,11 +488,11 @@ contract Ladle is LadleStorage, AccessControl() {
}

/// @dev Retrieve any asset or fyToken in the Ladle
function _retrieve(bytes6 id, bool asset, address to)
function _retrieve(bytes6 id, bool isAsset, address to)
private
returns (uint256 amount)
{
IERC20 token = IERC20(findToken(id, asset));
IERC20 token = IERC20(findToken(id, isAsset));
amount = token.balanceOf(address(this));
token.safeTransfer(to, amount);
}
Expand Down Expand Up @@ -522,26 +522,26 @@ contract Ladle is LadleStorage, AccessControl() {
// ---- Permit management ----

/// @dev From an id, which can be an assetId or a seriesId, find the resulting asset or fyToken
function findToken(bytes6 id, bool asset)
function findToken(bytes6 id, bool isAsset)
private view returns (address token)
{
token = asset ? cauldron.assets(id) : address(getSeries(id).fyToken);
token = isAsset ? cauldron.assets(id) : address(getSeries(id).fyToken);
require (token != address(0), "Token not found");
}

/// @dev Execute an ERC2612 permit for the selected asset or fyToken
function _forwardPermit(bytes6 id, bool asset, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
function _forwardPermit(bytes6 id, bool isAsset, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
private
{
IERC2612 token = IERC2612(findToken(id, asset));
IERC2612 token = IERC2612(findToken(id, isAsset));
token.permit(msg.sender, spender, amount, deadline, v, r, s);
}

/// @dev Execute a Dai-style permit for the selected asset or fyToken
function _forwardDaiPermit(bytes6 id, bool asset, address spender, uint256 nonce, uint256 deadline, bool allowed, uint8 v, bytes32 r, bytes32 s)
function _forwardDaiPermit(bytes6 id, bool isAsset, address spender, uint256 nonce, uint256 deadline, bool allowed, uint8 v, bytes32 r, bytes32 s)
private
{
DaiAbstract token = DaiAbstract(findToken(id, asset));
DaiAbstract token = DaiAbstract(findToken(id, isAsset));
token.permit(msg.sender, spender, nonce, deadline, allowed, v, r, s);
}

Expand Down
16 changes: 8 additions & 8 deletions src/ladleWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,26 +191,26 @@ export class LadleWrapper {
return this.batch([this.rollAction(vaultId, newSeriesId, max)])
}

public forwardPermitAction(id: string, asset: boolean, spender: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: Buffer, s: Buffer): BatchAction {
public forwardPermitAction(id: string, isAsset: boolean, spender: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: Buffer, s: Buffer): BatchAction {
return new BatchAction(OPS.FORWARD_PERMIT, ethers.utils.defaultAbiCoder.encode(
['bytes6', 'bool', 'address', 'uint256', 'uint256', 'uint8', 'bytes32', 'bytes32'],
[id, asset, spender, amount, deadline, v, r, s]
[id, isAsset, spender, amount, deadline, v, r, s]
))
}

public async forwardPermit(id: string, asset: boolean, spender: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: Buffer, s: Buffer): Promise<ContractTransaction> {
return this.batch([this.forwardPermitAction(id, asset, spender, amount, deadline, v, r, s)])
public async forwardPermit(id: string, isAsset: boolean, spender: string, amount: BigNumberish, deadline: BigNumberish, v: BigNumberish, r: Buffer, s: Buffer): Promise<ContractTransaction> {
return this.batch([this.forwardPermitAction(id, isAsset, spender, amount, deadline, v, r, s)])
}

public forwardDaiPermitAction(id: string, asset: boolean, spender: string, nonce: BigNumberish, deadline: BigNumberish, approved: boolean, v: BigNumberish, r: Buffer, s: Buffer): BatchAction {
public forwardDaiPermitAction(id: string, isAsset: boolean, spender: string, nonce: BigNumberish, deadline: BigNumberish, approved: boolean, v: BigNumberish, r: Buffer, s: Buffer): BatchAction {
return new BatchAction(OPS.FORWARD_DAI_PERMIT, ethers.utils.defaultAbiCoder.encode(
['bytes6', 'bool', 'address', 'uint256', 'uint256', 'bool', 'uint8', 'bytes32', 'bytes32'],
[id, asset, spender, nonce, deadline, approved, v, r, s]
[id, isAsset, spender, nonce, deadline, approved, v, r, s]
))
}

public async forwardDaiPermit(id: string, asset: boolean, spender: string, nonce: BigNumberish, deadline: BigNumberish, approved: boolean, v: BigNumberish, r: Buffer, s: Buffer): Promise<ContractTransaction> {
return this.batch([this.forwardDaiPermitAction(id, asset, spender, nonce, deadline, approved, v, r, s)])
public async forwardDaiPermit(id: string, isAsset: boolean, spender: string, nonce: BigNumberish, deadline: BigNumberish, approved: boolean, v: BigNumberish, r: Buffer, s: Buffer): Promise<ContractTransaction> {
return this.batch([this.forwardDaiPermitAction(id, isAsset, spender, nonce, deadline, approved, v, r, s)])
}

public joinEtherAction(etherId: string): BatchAction {
Expand Down

0 comments on commit 12f107b

Please sign in to comment.