StrategistOriginator

Git Source

Inherits: Ownable, Originator, TokenReceiverInterface

State Variables

SP

Starport public immutable SP;

EIP_DOMAIN

bytes32 public constant EIP_DOMAIN = keccak256("EIP712Domain(string version,uint256 chainId,address verifyingContract)");

ORIGINATOR_DETAILS_TYPEHASH

bytes32 public constant ORIGINATOR_DETAILS_TYPEHASH = keccak256("Origination(uint256 nonce,bytes32 hash)");

VERSION

bytes32 public constant VERSION = keccak256("0");

_DOMAIN_SEPARATOR

bytes32 internal immutable _DOMAIN_SEPARATOR;

usedHashes

mapping(bytes32 => bool) public usedHashes;

strategist

address public strategist;

_counter

uint256 private _counter;

Functions

constructor

constructor(Starport SP_, address strategist_, address owner);

setStrategist

Sets the strategist address

function setStrategist(address newStrategist) external onlyOwner;

Parameters

NameTypeDescription
newStrategistaddressThe new strategist address

incrementCounter

increments the Counter to invalidate any open offers

function incrementCounter() external;

originate

Accepts a request with signed data that is decoded by the originator communicates with Starport to originate a loan

function originate(Request calldata params) external virtual override;

Parameters

NameTypeDescription
paramsRequestThe request for the origination

encodeWithAccountCounter

Returns data that is encodePacked for signing

function encodeWithAccountCounter(bytes32 contextHash) public view virtual returns (bytes memory);

Parameters

NameTypeDescription
contextHashbytes32The hash of the data being signed

getCounter

Returns the nonce of the contract

function getCounter() public view virtual returns (uint256);

Returns

NameTypeDescription
<none>uint256_counter

domainSeparator

Returns the domain separator

function domainSeparator() public view virtual returns (bytes32);

Returns

NameTypeDescription
<none>bytes32_DOMAIN_SEPARATOR

_validateAsk

function _validateAsk(Request calldata request, Details memory details) internal virtual;

_validateOffer

function _validateOffer(Request calldata request, Details memory details) internal virtual;

_validateSignature

function _validateSignature(bytes32 hash, bytes memory signature) internal view virtual;

withdraw

function withdraw(SpentItem[] memory transfers, address recipient) external onlyOwner;

onERC721Received

function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
    public
    pure
    virtual
    override
    returns (bytes4);

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes calldata)
    external
    pure
    virtual
    override
    returns (bytes4);

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)
    external
    pure
    virtual
    override
    returns (bytes4);

Events

CounterUpdated

event CounterUpdated(uint256);

HashInvalidated

event HashInvalidated(bytes32 hash);

StrategistTransferred

event StrategistTransferred(address newStrategist);

Errors

AdditionalTransferError

error AdditionalTransferError();

InvalidCollateral

error InvalidCollateral();

InvalidDeadline

error InvalidDeadline();

InvalidDebt

error InvalidDebt();

InvalidDebtAmount

error InvalidDebtAmount();

InvalidDebtLength

error InvalidDebtLength();

InvalidOffer

error InvalidOffer();

InvalidSigner

error InvalidSigner();

NotAuthorized

error NotAuthorized();

NotStarport

error NotStarport();

Structs

Details

struct Details {
    address custodian;
    address issuer;
    uint256 deadline;
    Offer offer;
}

Offer

struct Offer {
    bytes32 salt;
    Starport.Terms terms;
    SpentItem[] collateral;
    SpentItem[] debt;
}