Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format all files #80

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Copyright (C) 2017, 2018, 2019 dbrock, rain, mrchico
// Copyright (C) 2021 Dai Foundation
pragma solidity ^0.8.18;

import "./auth/auth.sol";

interface ApproveLike {
function approve(address, uint256) external;
}

contract Escrow is Auth {

event Approve(address indexed token, address indexed spender, uint256 value);

constructor() {
Expand Down
80 changes: 38 additions & 42 deletions src/Gateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ interface InvestmentManagerLike {
function updateMember(uint64 poolId, bytes16 trancheId, address user, uint64 validUntil) external;
function updateTokenPrice(uint64 poolId, bytes16 trancheId, uint128 price) external;
function handleTransfer(uint128 currency, address recipient, uint128 amount) external;
function handleTransferTrancheTokens(uint64 poolId, bytes16 trancheId, uint128 currency, address destinationAddress, uint128 amount)
external;
function handleTransferTrancheTokens(
uint64 poolId,
bytes16 trancheId,
uint128 currency,
address destinationAddress,
uint128 amount
) external;
function handleExecutedDecreaseInvestOrder(
uint64 poolId,
bytes16 trancheId,
Expand Down Expand Up @@ -99,11 +104,11 @@ contract Gateway {
) {
investmentManager = InvestmentManagerLike(investmentManager_);
router = RouterLike(router_);

shortScheduleWait = shortScheduleWait_;
longScheduleWait = longScheduleWait_;
gracePeriod = gracePeriod_;

wards[msg.sender] = 1;
emit Rely(msg.sender);
}
Expand Down Expand Up @@ -183,7 +188,7 @@ contract Gateway {
bytes16 trancheId,
address sender,
bytes32 destinationAddress,
uint128 currencyId,
uint128 currencyId,
uint128 amount
) public onlyInvestmentManager pauseable {
router.send(
Expand Down Expand Up @@ -221,7 +226,11 @@ contract Gateway {
);
}

function transfer(uint128 token, address sender, bytes32 receiver, uint128 amount) public onlyInvestmentManager pauseable {
function transfer(uint128 token, address sender, bytes32 receiver, uint128 amount)
public
onlyInvestmentManager
pauseable
{
router.send(Messages.formatTransfer(token, addressToBytes32(sender), receiver, amount));
}

Expand All @@ -230,46 +239,46 @@ contract Gateway {
onlyInvestmentManager
pauseable
{
router.send(
Messages.formatIncreaseInvestOrder(poolId, trancheId, addressToBytes32(investor), currency, amount)
);
router.send(Messages.formatIncreaseInvestOrder(poolId, trancheId, addressToBytes32(investor), currency, amount));
}

function decreaseInvestOrder(uint64 poolId, bytes16 trancheId, address investor, uint128 currency, uint128 amount)
public
onlyInvestmentManager
pauseable
{
router.send(
Messages.formatDecreaseInvestOrder(poolId, trancheId, addressToBytes32(investor), currency, amount)
);
router.send(Messages.formatDecreaseInvestOrder(poolId, trancheId, addressToBytes32(investor), currency, amount));
}

function increaseRedeemOrder(uint64 poolId, bytes16 trancheId, address investor, uint128 currency, uint128 amount)
public
onlyInvestmentManager
pauseable
{
router.send(
Messages.formatIncreaseRedeemOrder(poolId, trancheId, addressToBytes32(investor), currency, amount)
);
router.send(Messages.formatIncreaseRedeemOrder(poolId, trancheId, addressToBytes32(investor), currency, amount));
}

function decreaseRedeemOrder(uint64 poolId, bytes16 trancheId, address investor, uint128 currency, uint128 amount)
public
onlyInvestmentManager
pauseable
{
router.send(
Messages.formatDecreaseRedeemOrder(poolId, trancheId, addressToBytes32(investor), currency, amount)
);
router.send(Messages.formatDecreaseRedeemOrder(poolId, trancheId, addressToBytes32(investor), currency, amount));
}

function collectInvest(uint64 poolId, bytes16 trancheId, address investor, uint128 currency) public onlyInvestmentManager pauseable {
function collectInvest(uint64 poolId, bytes16 trancheId, address investor, uint128 currency)
public
onlyInvestmentManager
pauseable
{
router.send(Messages.formatCollectInvest(poolId, trancheId, addressToBytes32(investor), currency));
}

function collectRedeem(uint64 poolId, bytes16 trancheId, address investor, uint128 currency) public onlyInvestmentManager pauseable {
function collectRedeem(uint64 poolId, bytes16 trancheId, address investor, uint128 currency)
public
onlyInvestmentManager
pauseable
{
router.send(Messages.formatCollectRedeem(poolId, trancheId, addressToBytes32(investor), currency));
}

Expand Down Expand Up @@ -297,40 +306,27 @@ contract Gateway {
) = Messages.parseAddTranche(_msg);
investmentManager.addTranche(poolId, trancheId, tokenName, tokenSymbol, decimals, price);
} else if (Messages.isUpdateMember(_msg)) {
(uint64 poolId, bytes16 trancheId, address user, uint64 validUntil) =
Messages.parseUpdateMember(_msg);
(uint64 poolId, bytes16 trancheId, address user, uint64 validUntil) = Messages.parseUpdateMember(_msg);
investmentManager.updateMember(poolId, trancheId, user, validUntil);
} else if (Messages.isUpdateTrancheTokenPrice(_msg)) {
(uint64 poolId, bytes16 trancheId, uint128 price) = Messages.parseUpdateTrancheTokenPrice(_msg);
investmentManager.updateTokenPrice(poolId, trancheId, price);
} else if (Messages.isTransfer(_msg)) {
(uint128 currency, address recipient, uint128 amount) = Messages.parseIncomingTransfer(_msg);
investmentManager.handleTransfer(currency, recipient, amount);
}
}
// else if (Messages.isTransferTrancheTokens(_msg)) {
// (uint64 poolId, bytes16 trancheId, uint128 currencyId, address destinationAddress, uint128 amount) =
// Messages.parseTransferTrancheTokens20(_msg);
// investmentManager.handleTransferTrancheTokens(poolId, trancheId, currencyId, destinationAddress, amount);
// }
else if (Messages.isExecutedDecreaseInvestOrder(_msg)) {
(
uint64 poolId,
bytes16 trancheId,
address investor,
uint128 currency,
uint128 currencyPayout
) = Messages.parseExecutedDecreaseInvestOrder(_msg);
investmentManager.handleExecutedDecreaseInvestOrder(
poolId, trancheId, investor, currency, currencyPayout
);
// }
else if (Messages.isExecutedDecreaseInvestOrder(_msg)) {
(uint64 poolId, bytes16 trancheId, address investor, uint128 currency, uint128 currencyPayout) =
Messages.parseExecutedDecreaseInvestOrder(_msg);
investmentManager.handleExecutedDecreaseInvestOrder(poolId, trancheId, investor, currency, currencyPayout);
} else if (Messages.isExecutedDecreaseRedeemOrder(_msg)) {
(
uint64 poolId,
bytes16 trancheId,
address investor,
uint128 currency,
uint128 trancheTokensPayout
) = Messages.parseExecutedDecreaseRedeemOrder(_msg);
(uint64 poolId, bytes16 trancheId, address investor, uint128 currency, uint128 trancheTokensPayout) =
Messages.parseExecutedDecreaseRedeemOrder(_msg);
investmentManager.handleExecutedDecreaseRedeemOrder(
poolId, trancheId, investor, currency, trancheTokensPayout
);
Expand Down
Loading
Loading