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

Website: Minor fixes of names #685

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
50 changes: 25 additions & 25 deletions ERCS/erc-6123.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ which can be processed in a completely frictionless way.

### Methods

The following methods specify a Smart Derivative Contract's trade initiation and settlement life cycle. For further information, please also look at the interface documentation ISDC.sol.
The following methods specify a Smart Derivative Contract's trade initiation, trade termination and settlement life cycle. For further information, please also look at the interface documentation ISDC.sol.

#### Trade Initiation Phase: `inceptTrade`

Expand Down Expand Up @@ -89,56 +89,56 @@ The counterparty that called `inceptTrade` has the option to cancel the trade, e
function cancelTrade(address withParty, string memory tradeData, int position, int256 paymentAmount, string memory initialSettlementData) external;
```

#### Trade Settlement Phase: `initiateSettlement`
#### Trade Termination: `requestTermination`

Allows eligible participants (such as counterparties or a delegated agent) to trigger a settlement phase.
Allows an eligible party to request a mutual termination of the trade with the correspondig `tradeId` with a termination amount she is willing to pay and provide further termination terms (e.g. an XML)

```solidity
function initiateSettlement() external;
function requestTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

#### Trade Settlement Phase: `performSettlement`
#### Trade Termination: `confirmTradeTermination`

Valuation may be provided on-chain or off-chain via an external oracle service that calculates the settlement or coupon amounts and uses external market data.
This method serves as a callback called from an external oracle providing settlement amount and used settlement data, which also get stored.
The settlement amount will be checked according to contract terms, resulting in either a regular settlement or a termination of the trade.
Allows an eligible party to confirm a previously requested (mutual) trade termination, including termination payment value and termination terms

```solidity
function performSettlement(int256 settlementAmount, string memory settlementData) external;
function confirmTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

#### Trade Settlement Phase: `afterTransfer`
#### Trade Termination: `cancelTradeTermination`

This method - either called back from the provided settlement token directly or from an eligible address - completes the settlement transfer.
This might result in a termination or start of the next settlement phase, depending on the provided success flag.
The transactionData is emitted as part of the corresponding event: `TradeSettled` or `TradeTerminated`
The party that initiated `requestTradeTermination` has the option to withdraw the request, e.g., in the case where the termination is not confirmed in a timely manner.

```solidity
function afterTransfer(bool success, string memory transactionData) external;
function cancelTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
```

#### Trade Termination: `requestTermination`
#### Settlement Phase: `initiateSettlement`

Allows an eligible party to request a mutual termination of the trade with the correspondig `tradeId` with a termination amount she is willing to pay and provide further termination terms (e.g. an XML)
Allows eligible participants (such as counterparties or a delegated agent) to trigger a settlement phase.

```solidity
function requestTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
function initiateSettlement() external;
```

#### Trade Termination: `confirmTradeTermination`
#### Settlement Phase: `performSettlement`

Allows an eligible party to confirm a previously requested (mutual) trade termination, including termination payment value and termination terms
Valuation may be provided on-chain or off-chain via an external oracle service that calculates the settlement or coupon amounts and uses external market data.
This method serves as a callback called from an external oracle providing settlement amount and used settlement data, which also get stored.
The settlement amount will be checked according to contract terms, resulting in either a regular settlement or a termination of the trade.

```solidity
function confirmTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
function performSettlement(int256 settlementAmount, string memory settlementData) external;
```

#### Trade Termination: `cancelTradeTermination`
#### Settlement Phase: `afterTransfer`

The party that initiated `requestTradeTermination` has the option to withdraw the request, e.g., in the case where the termination is not confirmed in a timely manner.
This method - either called back from the provided settlement token directly or from an eligible address - completes the settlement transfer.
The transactionData is emitted as part of the corresponding event: `SettlementTransferred` or `SettlementFailed`
This might result in a termination or start of the next settlement phase, depending on the provided success flag.

```solidity
function cancelTradeTermination(string memory tradeId, int256 terminationPayment, string memory terminationTerms) external;
function afterTransfer(bool success, string memory transactionData) external;
```


Expand Down Expand Up @@ -223,12 +223,12 @@ Emitted when a settlement is requested. May trigger the settlement phase.
event SettlementRequested(address initiator, string tradeData, string lastSettlementData);
```

#### SettlementEvaluated
#### SettlementDetermined

Emitted when the settlement phase is started.

```solidity
event SettlementEvaluated(address initiator, int256 settlementAmount, string settlementData);
event SettlementDetermined(address initiator, int256 settlementAmount, string settlementData);
```

#### SettlementTransferred
Expand Down
4 changes: 2 additions & 2 deletions assets/erc-6123/contracts/ISDC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ interface ISDC {
* @param settlementAmount the settlement amount. If settlementAmount > 0 then receivingParty receives this amount from other party. If settlementAmount < 0 then other party receives -settlementAmount from receivingParty.
* @param settlementData. the tripple (product, previousSettlementData, settlementData) determines the settlementAmount.
*/
event SettlementEvaluated(address initiator, int256 settlementAmount, string settlementData);
event SettlementDetermined(address initiator, int256 settlementAmount, string settlementData);

/**
* @dev Emitted when settlement process has been finished
Expand Down Expand Up @@ -212,7 +212,7 @@ interface ISDC {

/**
* @notice Called to trigger according settlement on chain-balances callback for initiateSettlement() event handler
* @dev perform settlement checks, may initiate transfers and emits {SettlementEvaluated}
* @dev perform settlement checks, may initiate transfers and emits {SettlementDetermined}
* @param settlementAmount the settlement amount. If settlementAmount > 0 then receivingParty receives this amount from other party. If settlementAmount < 0 then other party receives -settlementAmount from receivingParty.
* @param settlementData. the tripple (product, previousSettlementData, settlementData) determines the settlementAmount.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ contract SDCSingleTradePledgedBalance is SDCSingleTrade {
address[] memory to = new address[](1);
uint256[] memory amounts = new uint256[](1);
from[0] = settlementPayer; to[0] = otherParty(settlementPayer); amounts[0] = transferAmount;
emit SettlementEvaluated(msg.sender, settlementAmount, _settlementData);
emit SettlementDetermined(msg.sender, settlementAmount, _settlementData);
setTradeState(TradeState.InTransfer);
settlementToken.checkedBatchTransferFrom(from,to,amounts,transactionID);
}
Expand Down
2 changes: 1 addition & 1 deletion assets/erc-6123/doc/sequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ValuationService->EventHandler: return valuation data
EventHandler->SDC: callback: tx 'performSettlement'
SDC->SDC:Caps Settlement Amount at Margin Buffer Level

SDC-->EventHandler: emit SettlementEvaluated
SDC-->EventHandler: emit SettlementDetermined

SDC->SettlementToken: tx 'transferFrom' settlement amount from Paying Party to Receiving Party Balance
== TradeState 'inTransfer' ==
Expand Down
2 changes: 1 addition & 1 deletion assets/erc-6123/doc/sequence.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions assets/erc-6123/test/SDCTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe("Livecycle Unit-Tests for SDC Plege Balance", () => {
await expect(initSettlementPhase).to.emit(sdc, "SettlementRequested");

const performSettlementCall = sdc.connect(counterparty1).performSettlement(settlementAmount,"settlementData");
await expect(performSettlementCall).to.emit(sdc, "SettlementEvaluated");
await expect(performSettlementCall).to.emit(sdc, "SettlementDetermined");
let trade_state = await sdc.connect(counterparty1).getTradeState();
await expect(trade_state).equal(TradeState.Settled);
let sdc_balance = await token.connect(counterparty1).balanceOf(sdc.address);
Expand Down Expand Up @@ -291,7 +291,7 @@ describe("Livecycle Unit-Tests for SDC Plege Balance", () => {
await expect(initSettlementPhase).to.emit(sdc, "SettlementRequested");

const performSettlementCall = sdc.connect(counterparty1).performSettlement(settlementAmount,"settlementData");
await expect(performSettlementCall).to.emit(sdc, "SettlementEvaluated");
await expect(performSettlementCall).to.emit(sdc, "SettlementDetermined");
let trade_state = await sdc.connect(counterparty1).getTradeState();
let sdc_balance = await token.connect(counterparty1).balanceOf(sdc.address);
let cp1_balance = await token.connect(counterparty1).balanceOf(counterparty1.address);
Expand Down
Loading