Skip to content

Commit

Permalink
feat(list-proposal): extend simple loan list offer by list request an…
Browse files Browse the repository at this point in the history
…d rename to proposal
  • Loading branch information
ashhanai committed Mar 22, 2024
1 parent f5957b1 commit ce0a4eb
Show file tree
Hide file tree
Showing 10 changed files with 860 additions and 1,347 deletions.
24 changes: 6 additions & 18 deletions script/PWN.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IPWNDeployer } from "@pwn/deployer/IPWNDeployer.sol";
import { PWNHub } from "@pwn/hub/PWNHub.sol";
import { PWNHubTags } from "@pwn/hub/PWNHubTags.sol";
import { PWNSimpleLoan } from "@pwn/loan/terms/simple/loan/PWNSimpleLoan.sol";
import { PWNSimpleLoanListOffer } from "@pwn/loan/terms/simple/proposal/offer/PWNSimpleLoanListOffer.sol";
import { PWNSimpleLoanListProposal } from "@pwn/loan/terms/simple/proposal/PWNSimpleLoanListProposal.sol";
import { PWNSimpleLoanSimpleProposal } from "@pwn/loan/terms/simple/proposal/PWNSimpleLoanSimpleProposal.sol";
import { PWNLOAN } from "@pwn/loan/token/PWNLOAN.sol";
import { PWNRevokedNonce } from "@pwn/nonce/PWNRevokedNonce.sol";
Expand All @@ -40,11 +40,9 @@ library PWNContractDeployerSalt {

// Proposal types
bytes32 internal constant SIMPLE_LOAN_SIMPLE_PROPOSAL = keccak256("PWNSimpleLoanSimpleProposal");
bytes32 internal constant SIMPLE_LOAN_LIST_PROPOSAL = keccak256("PWNSimpleLoanListProposal");
bytes32 internal constant SIMPLE_LOAN_FUNGIBLE_PROPOSAL = keccak256("PWNSimpleLoanFungibleProposal");

// Offer types
bytes32 internal constant SIMPLE_LOAN_LIST_OFFER = keccak256("PWNSimpleLoanListOffer");

}


Expand Down Expand Up @@ -171,22 +169,12 @@ forge script script/PWN.s.sol:Deploy \
)
}));

// - Offers
simpleLoanListOffer = PWNSimpleLoanListOffer(_deploy({
salt: PWNContractDeployerSalt.SIMPLE_LOAN_LIST_OFFER,
bytecode: abi.encodePacked(
type(PWNSimpleLoanListOffer).creationCode,
abi.encode(address(hub), address(revokedNonce))
)
}));

console2.log("PWNConfig - singleton:", configSingleton);
console2.log("PWNConfig - proxy:", address(config));
console2.log("PWNHub:", address(hub));
console2.log("PWNLOAN:", address(loanToken));
console2.log("PWNRevokedNonce:", address(revokedNonce));
console2.log("PWNSimpleLoan:", address(simpleLoan));
console2.log("PWNSimpleLoanListOffer:", address(simpleLoanListOffer));

vm.stopBroadcast();
}
Expand Down Expand Up @@ -267,14 +255,14 @@ forge script script/PWN.s.sol:Setup \
address[] memory addrs = new address[](4);
addrs[0] = address(simpleLoan);
addrs[1] = address(simpleLoan);
addrs[2] = address(simpleLoanListOffer);
addrs[3] = address(simpleLoanListOffer);
// addrs[2] = address(simpleLoanListOffer);
// addrs[3] = address(simpleLoanListOffer);

bytes32[] memory tags = new bytes32[](4);
tags[0] = PWNHubTags.ACTIVE_LOAN;
tags[1] = PWNHubTags.NONCE_MANAGER;
tags[2] = PWNHubTags.LOAN_PROPOSAL;
tags[3] = PWNHubTags.NONCE_MANAGER;
// tags[2] = PWNHubTags.LOAN_PROPOSAL;
// tags[3] = PWNHubTags.NONCE_MANAGER;

bool success = GnosisSafeLike(protocolSafe).execTransaction({
to: address(hub),
Expand Down
5 changes: 1 addition & 4 deletions src/Deployments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IPWNDeployer } from "@pwn/deployer/IPWNDeployer.sol";
import { PWNHub } from "@pwn/hub/PWNHub.sol";
import { PWNHubTags } from "@pwn/hub/PWNHubTags.sol";
import { PWNSimpleLoan } from "@pwn/loan/terms/simple/loan/PWNSimpleLoan.sol";
import { PWNSimpleLoanListOffer } from "@pwn/loan/terms/simple/proposal/offer/PWNSimpleLoanListOffer.sol";
import { PWNSimpleLoanListProposal } from "@pwn/loan/terms/simple/proposal/PWNSimpleLoanListProposal.sol";
import { PWNSimpleLoanSimpleProposal } from "@pwn/loan/terms/simple/proposal/PWNSimpleLoanSimpleProposal.sol";
import { PWNLOAN } from "@pwn/loan/token/PWNLOAN.sol";
import { PWNRevokedNonce } from "@pwn/nonce/PWNRevokedNonce.sol";
Expand Down Expand Up @@ -44,7 +44,6 @@ abstract contract Deployments is CommonBase {
address protocolTimelock;
PWNRevokedNonce revokedNonce;
PWNSimpleLoan simpleLoan;
PWNSimpleLoanListOffer simpleLoanListOffer;
StateFingerprintComputerRegistry stateFingerprintComputerRegistry;
}

Expand All @@ -68,7 +67,6 @@ abstract contract Deployments is CommonBase {
PWNLOAN loanToken;
PWNSimpleLoan simpleLoan;
PWNRevokedNonce revokedNonce;
PWNSimpleLoanListOffer simpleLoanListOffer;


function _loadDeployedAddresses() internal {
Expand Down Expand Up @@ -96,7 +94,6 @@ abstract contract Deployments is CommonBase {
loanToken = deployment.loanToken;
simpleLoan = deployment.simpleLoan;
revokedNonce = deployment.revokedNonce;
simpleLoanListOffer = deployment.simpleLoanListOffer;
stateFingerprintComputerRegistry = deployment.stateFingerprintComputerRegistry;
categoryRegistry = deployment.categoryRegistry;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ contract PWNSimpleLoanFungibleProposal is PWNSimpleLoanProposal {
}

/**
* @notice Construct defining proposal concrete values
* @notice Construct defining proposal concrete values.
* @param collateralAmount Amount of collateral to be used in the loan.
*/
struct ProposalValues {
Expand Down
Loading

0 comments on commit ce0a4eb

Please sign in to comment.