CapSign
  • Home
  • Compliance Framework
  • Interactive Demos
    • Overview
  • Create an Account
  • Identity Verification
  • Investor Qualification
  • Guides for Individuals
    • Invest in an Offering
  • Guides for Corporations
    • Create a Share Class
    • Authorize Shares
    • Issue Shares
    • Upload a Document
    • Create a Document Template
    • Create an Offering
    • Manage Your Offering
    • Add a Trusted Attestor
    • Approve an Investment
  • API Reference
    • Overview
    • Compliance
      • Exemptions
        • FederalExemption.sol
          • FederalExemption
        • RegAExemption.sol
          • RegAExemption
        • RegCFExemption.sol
          • RegCFExemption
        • RegDExemption.sol
          • RegDExemption
        • Rule144Exemption.sol
          • Rule144Exemption
        • Rule701Exemption.sol
          • Rule701Exemption
      • IComplianceModule.sol
        • IComplianceModule
      • Vesting.sol
        • Vesting
    • Currencies
      • WETH.sol
        • WETH
      • CMX.sol
        • CMX
      • USD.sol
        • USD
    • Governance
      • BoardManagement.sol
        • BoardManagement
      • ProxyVoting.sol
        • ProxyVoting
    • Identity
      • AttestationRegistry.sol
        • AttestationRegistry
      • ERC20PaymentResolver.sol
        • ERC20PaymentResolver
      • Roles
        • BaseRoles.sol
          • BaseRoles
        • PrivateOfferingRoles.sol
          • PrivateOfferingRoles
        • PublicOfferingRoles.sol
          • PublicOfferingRoles
      • Whitelist.sol
        • Whitelist
    • Issuance
      • Compensation
        • CompensationFactory.sol
          • CompensationFactory
        • EmployeeStockOptionCompensation.sol
          • EmployeeStockOptionCompensation
        • RestrictedStockAwardCompensation.sol
          • RestrictedStockAwardCompensation
        • StockAppreciationRightsCompensation.sol
          • StockAppreciationRightCompensation
        • WarrantCompensation.sol
          • WarrantCompensation
      • Offering
        • ExemptOffering.sol
          • ExemptOffering
        • InitialPublicOffering.sol
          • InitialPublicOffering
        • Offering.sol
          • Offering
        • OfferingFactory.sol
          • OfferingFactory
        • Rule506bOffering.sol
          • Rule506bOffering
        • Rule506cOffering.sol
          • Rule506cOffering
        • TenderOffer.sol
          • TenderOffer
    • Investor Relations
      • DividendDistributor.sol
        • DividendDistributor
      • SubscriptionManager.sol
        • SubscriptionManager
        • IERC20
    • Ledgers
      • Ledger.sol
        • Ledger
      • LedgerManager.sol
        • LedgerManager
      • SettlementManager.sol
        • SettlementManager
    • Marketplace
      • AuctionMarket.sol
        • AuctionMarket
      • BaseMarket.sol
        • BaseMarket
      • BulletinBoardMarket.sol
        • BulletinBoardMarket
      • Contents
        • BaseCollateral.sol
          • BaseCollateral
        • ERC20Collateral.sol
          • ERC20Collateral
        • NativeCollateral.sol
          • NativeCollateral
      • LiquidityPoolMarket.sol
        • LiquidityPoolMarket
      • Contents
        • BaseMargin.sol
          • BaseMargin
        • MarginAccount.sol
          • MarginAccount
      • MarginOrderBookMarket.sol
        • MarginOrderBookMarket
      • OTCMarket.sol
        • OTCMarket
      • OrderBookMarket.sol
        • OrderBookMarket
      • Contents
        • BrokerNetSettlement.sol
          • BrokerNetSettlement
        • CustodyBridge.sol
          • CustodyBridge
        • DirectSettlement.sol
          • DirectSettlement
        • ListingRegistry.sol
          • ListingRegistry
    • Tokenization
      • Actions
        • CorporateActionManager.sol
          • CorporateActionManager
          • ICapitalAsset
        • ICorporateActionManager.sol
          • ICorporateActionManager
      • Assets
        • Asset.sol
          • Asset
          • Asset
        • ClosedEndFundClass.sol
          • ClosedEndFundClass
        • ClosedEndFundManager.sol
          • ClosedEndFundManager
        • EmployeeStockOption.sol
          • EmployeeStockOption
        • Contents
          • IAsset.sol
            • IAsset
          • IClosedEndFundClass.sol
            • IClosedEndFundClass
          • IIssuedAsset.sol
            • IIssuedAsset
          • IOpenEndFundClass.sol
            • IOpenEndFundClass
          • IShareClass.sol
            • IShareClass
        • IssuedAsset.sol
          • IssuedAsset
        • OpenEndFundClass.sol
          • OpenEndFundClass
        • OpenEndFundManager.sol
          • OpenEndFundManager
        • ShareClass.sol
          • ShareClass
        • StockAppreciationRight.sol
          • StockAppreciationRight
        • Warrant.sol
          • Warrant
      • TokenFactory.sol
        • TokenFactory
    • Utilities
      • PriceFeed.sol
        • SimplePriceFeed
        • IPriceFeed
    • Valuations
      • ValuationRegistry.sol
        • ValuationRegistry
    • Wallet
      • HookedSmartWallet.sol
        • HookedSmartWallet
      • Wallet.sol
        • Wallet
Powered by GitBook
On this page
  • State Variables
  • brokerNetSettlement
  • baseAsset
  • owner
  • Functions
  • onlyOwner
  • constructor
  • moveToDRS
  • moveFromDRS
  • _reduceBrokerBalance
  • _increaseBrokerBalance
  • setClearingLedger
  • setAssetRegistry
  • setOwner
  • Events
  • MovedToDRS
  • MovedFromDRS

Was this helpful?

  1. API Reference
  2. Marketplace
  3. Contents
  4. CustodyBridge.sol

CustodyBridge

PreviousCustodyBridge.solNextDirectSettlement.sol

Last updated 3 months ago

Was this helpful?

A helper (bridge) contract that coordinates moving securities between a broker's net balance in BrokerNetSettlement and a user's DRS lot in Token. Example usage:

  1. moveToDRS(broker, user, amount, costBasis, acquisitionDate)

  • Subtracts amount from broker's netBalance in BrokerNetSettlement.

  • Creates a new lot in Token for user.

  1. moveFromDRS(user, broker, tokenId, rawQuantity)

  • Invalidates or partially sells from the user's lot in Token.

  • Adds rawQuantity back to broker's netBalance in BrokerNetSettlement.

State Variables

brokerNetSettlement

BrokerNetSettlement public brokerNetSettlement;

baseAsset

IAsset public baseAsset;

owner

address public owner;

Functions

onlyOwner

modifier onlyOwner();

constructor

constructor(address _clearingLedger, address _baseAsset);

moveToDRS

Moves amount securities from broker's net balance into a new DRS lot for user. This effectively reduces the broker's netBalance by amount and calls createLot in CapitalAsset.

function moveToDRS(
    address broker,
    address user,
    uint256 amount,
    uint96 costBasis,
    uint64 acquisitionDate,
    string memory uri,
    bytes memory data
) external onlyOwner returns (bytes32 tokenId);

Parameters

Name
Type
Description

broker

address

The broker address in BrokerNetSettlement.

user

address

The end user who will own the new DRS lot.

amount

uint256

The quantity to move from netBalance to the new lot.

costBasis

uint96

The raw cost basis per share (if relevant).

acquisitionDate

uint64

A timestamp or date representing the original purchase date.

uri

string

The URI of the lot.

data

bytes

Additional data associated with the lot.

moveFromDRS

Moves rawQuantity securities from a user's DRS lot back to a broker's netBalance. We call sellFromToken on the CapitalAsset to partially or fully remove from the lot, then increment the broker's netBalance in BrokerNetSettlement.

function moveFromDRS(
    address user,
    address broker,
    bytes32 tokenId,
    uint96 rawQuantity,
    string memory uri,
    bytes memory data
) external onlyOwner;

Parameters

Name
Type
Description

user

address

The user whose DRS lot is being reduced.

broker

address

The broker that regains these securities in netBalance.

tokenId

bytes32

The user's lot ID in CapitalAsset.

rawQuantity

uint96

The raw quantity to remove from the lot (not the real post-split quantity).

uri

string

The URI of the lot.

data

bytes

Additional data associated with the lot.

_reduceBrokerBalance

*The underlying step to reduce a broker's netBalance by amount. We can do this by calling brokerNetSettlement's existing functions:

  • brokerNetSettlement.transfer(...) from broker to address(0) if allowed

  • or brokerNetSettlement.burn(...) if broker calls it For simplicity, we do a "batch" approach with negative deltas if the function is public. We illustrate a direct approach here, but it might need broker's signature in a real scenario.*

function _reduceBrokerBalance(address broker, uint256 amount) internal;

_increaseBrokerBalance

Internal function to increase a broker's netBalance in BrokerNetSettlement. Utilizes the BrokerNetSettlement's createLot function to add securities.

function _increaseBrokerBalance(address broker, uint256 amount) internal;

Parameters

Name
Type
Description

broker

address

The broker whose netBalance is to be increased.

amount

uint256

The amount to increase.

setClearingLedger

Allows the owner to update the BrokerNetSettlement address.

function setClearingLedger(address _clearingLedger) external onlyOwner;

Parameters

Name
Type
Description

_clearingLedger

address

The new BrokerNetSettlement address.

setAssetRegistry

Allows the owner to update the Token address.

function setAssetRegistry(address _baseAsset) external onlyOwner;

Parameters

Name
Type
Description

_baseAsset

address

The new Token address.

setOwner

(Optional) convenience function for advanced bridging, e.g. user -> user direct or multiple brokers in one go, etc. Kept minimal in this example.

function setOwner(address newOwner) external onlyOwner;

Events

MovedToDRS

event MovedToDRS(address indexed broker, address indexed user, uint256 amount, bytes32 tokenId, string uri, bytes data);

MovedFromDRS

event MovedFromDRS(
    address indexed user, address indexed broker, bytes32 tokenId, uint256 amount, string uri, bytes data
);
Git Source