xdr/Stellar-transaction.x in stellar-base-0.19.0 vs xdr/Stellar-transaction.x in stellar-base-0.20.0

- old
+ new

@@ -16,30 +16,30 @@ enum OperationType { CREATE_ACCOUNT = 0, PAYMENT = 1, PATH_PAYMENT = 2, - MANAGE_OFFER = 3, - CREATE_PASSIVE_OFFER = 4, + MANAGE_SELL_OFFER = 3, + CREATE_PASSIVE_SELL_OFFER = 4, SET_OPTIONS = 5, CHANGE_TRUST = 6, ALLOW_TRUST = 7, ACCOUNT_MERGE = 8, INFLATION = 9, MANAGE_DATA = 10, - BUMP_SEQUENCE = 11 + BUMP_SEQUENCE = 11, + MANAGE_BUY_OFFER = 12 }; /* CreateAccount Creates and funds a new account with the specified starting balance. Threshold: med Result: CreateAccountResult */ - struct CreateAccountOp { AccountID destination; // account to create int64 startingBalance; // amount they end up with }; @@ -86,32 +86,51 @@ /* Creates, updates or deletes an offer Threshold: med -Result: ManageOfferResult +Result: ManageSellOfferResult */ -struct ManageOfferOp +struct ManageSellOfferOp { Asset selling; Asset buying; int64 amount; // amount being sold. if set to 0, delete the offer Price price; // price of thing being sold in terms of what you are buying // 0=create a new offer, otherwise edit an existing offer - uint64 offerID; + int64 offerID; }; +/* Creates, updates or deletes an offer with amount in terms of buying asset + +Threshold: med + +Result: ManageBuyOfferResult + +*/ +struct ManageBuyOfferOp +{ + Asset selling; + Asset buying; + int64 buyAmount; // amount being bought. if set to 0, delete the offer + Price price; // price of thing being bought in terms of what you are + // selling + + // 0=create a new offer, otherwise edit an existing offer + int64 offerID; +}; + /* Creates an offer that doesn't take offers of the same price Threshold: med -Result: CreatePassiveOfferResult +Result: CreatePassiveSellOfferResult */ -struct CreatePassiveOfferOp +struct CreatePassiveSellOfferOp { Asset selling; // A Asset buying; // B int64 amount; // amount taker gets. if set to 0, delete the offer Price price; // cost of A in terms of B @@ -124,11 +143,10 @@ Threshold: med or high Result: SetOptionsResult */ - struct SetOptionsOp { AccountID* inflationDest; // sets the inflation destination uint32* clearFlags; // which flags to clear @@ -176,14 +194,14 @@ AccountID trustor; union switch (AssetType type) { // ASSET_TYPE_NATIVE is not allowed case ASSET_TYPE_CREDIT_ALPHANUM4: - opaque assetCode4[4]; + AssetCode4 assetCode4; case ASSET_TYPE_CREDIT_ALPHANUM12: - opaque assetCode12[12]; + AssetCode12 assetCode12; // add other asset types here in the future } asset; @@ -213,11 +231,10 @@ Threshold: med Result: ManageDataResult */ - struct ManageDataOp { string64 dataName; DataValue* dataValue; // set to null to clear }; @@ -228,11 +245,10 @@ Threshold: low Result: BumpSequenceResult */ - struct BumpSequenceOp { SequenceNumber bumpTo; }; @@ -250,14 +266,14 @@ CreateAccountOp createAccountOp; case PAYMENT: PaymentOp paymentOp; case PATH_PAYMENT: PathPaymentOp pathPaymentOp; - case MANAGE_OFFER: - ManageOfferOp manageOfferOp; - case CREATE_PASSIVE_OFFER: - CreatePassiveOfferOp createPassiveOfferOp; + case MANAGE_SELL_OFFER: + ManageSellOfferOp manageSellOfferOp; + case CREATE_PASSIVE_SELL_OFFER: + CreatePassiveSellOfferOp createPassiveSellOfferOp; case SET_OPTIONS: SetOptionsOp setOptionsOp; case CHANGE_TRUST: ChangeTrustOp changeTrustOp; case ALLOW_TRUST: @@ -268,10 +284,12 @@ void; case MANAGE_DATA: ManageDataOp manageDataOp; case BUMP_SEQUENCE: BumpSequenceOp bumpSequenceOp; + case MANAGE_BUY_OFFER: + ManageBuyOfferOp manageBuyOfferOp; } body; }; enum MemoType @@ -297,22 +315,24 @@ Hash retHash; // the hash of the tx you are rejecting }; struct TimeBounds { - uint64 minTime; - uint64 maxTime; // 0 here means no maxTime + TimePoint minTime; + TimePoint maxTime; // 0 here means no maxTime }; +// maximum number of operations per transaction +const MAX_OPS_PER_TX = 100; + /* a transaction is a container for a set of operations - is executed by an account - fees are collected from the account - operations are executed in order as one ACID transaction either all operations are applied or none are if any returns a failing code */ - struct Transaction { // account used to run the transaction AccountID sourceAccount; @@ -325,11 +345,11 @@ // validity range (inclusive) for the last ledger close time TimeBounds* timeBounds; Memo memo; - Operation operations<100>; + Operation operations<MAX_OPS_PER_TX>; // reserved for future use union switch (int v) { case 0: @@ -364,11 +384,11 @@ /* This result is used when offers are taken during an operation */ struct ClaimOfferAtom { // emitted to identify the offer AccountID sellerID; // Account that owns the offer - uint64 offerID; + int64 offerID; // amount and asset taken from the owner Asset assetSold; int64 amountSold; @@ -468,33 +488,33 @@ Asset noIssuer; // the asset that caused the error default: void; }; -/******* ManageOffer Result ********/ +/******* ManageSellOffer Result ********/ -enum ManageOfferResultCode +enum ManageSellOfferResultCode { // codes considered as "success" for the operation - MANAGE_OFFER_SUCCESS = 0, + MANAGE_SELL_OFFER_SUCCESS = 0, // codes considered as "failure" for the operation - MANAGE_OFFER_MALFORMED = -1, // generated offer would be invalid - MANAGE_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling - MANAGE_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying - MANAGE_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell - MANAGE_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy - MANAGE_OFFER_LINE_FULL = -6, // can't receive more of what it's buying - MANAGE_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell - MANAGE_OFFER_CROSS_SELF = -8, // would cross an offer from the same user - MANAGE_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling - MANAGE_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying + MANAGE_SELL_OFFER_MALFORMED = -1, // generated offer would be invalid + MANAGE_SELL_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling + MANAGE_SELL_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying + MANAGE_SELL_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell + MANAGE_SELL_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy + MANAGE_SELL_OFFER_LINE_FULL = -6, // can't receive more of what it's buying + MANAGE_SELL_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell + MANAGE_SELL_OFFER_CROSS_SELF = -8, // would cross an offer from the same user + MANAGE_SELL_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling + MANAGE_SELL_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying // update errors - MANAGE_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer + MANAGE_SELL_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer - MANAGE_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer + MANAGE_SELL_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer }; enum ManageOfferEffect { MANAGE_OFFER_CREATED = 0, @@ -516,18 +536,51 @@ void; } offer; }; -union ManageOfferResult switch (ManageOfferResultCode code) +union ManageSellOfferResult switch (ManageSellOfferResultCode code) { -case MANAGE_OFFER_SUCCESS: +case MANAGE_SELL_OFFER_SUCCESS: ManageOfferSuccessResult success; default: void; }; +/******* ManageBuyOffer Result ********/ + +enum ManageBuyOfferResultCode +{ + // codes considered as "success" for the operation + MANAGE_BUY_OFFER_SUCCESS = 0, + + // codes considered as "failure" for the operation + MANAGE_BUY_OFFER_MALFORMED = -1, // generated offer would be invalid + MANAGE_BUY_OFFER_SELL_NO_TRUST = -2, // no trust line for what we're selling + MANAGE_BUY_OFFER_BUY_NO_TRUST = -3, // no trust line for what we're buying + MANAGE_BUY_OFFER_SELL_NOT_AUTHORIZED = -4, // not authorized to sell + MANAGE_BUY_OFFER_BUY_NOT_AUTHORIZED = -5, // not authorized to buy + MANAGE_BUY_OFFER_LINE_FULL = -6, // can't receive more of what it's buying + MANAGE_BUY_OFFER_UNDERFUNDED = -7, // doesn't hold what it's trying to sell + MANAGE_BUY_OFFER_CROSS_SELF = -8, // would cross an offer from the same user + MANAGE_BUY_OFFER_SELL_NO_ISSUER = -9, // no issuer for what we're selling + MANAGE_BUY_OFFER_BUY_NO_ISSUER = -10, // no issuer for what we're buying + + // update errors + MANAGE_BUY_OFFER_NOT_FOUND = -11, // offerID does not match an existing offer + + MANAGE_BUY_OFFER_LOW_RESERVE = -12 // not enough funds to create a new Offer +}; + +union ManageBuyOfferResult switch (ManageBuyOfferResultCode code) +{ +case MANAGE_BUY_OFFER_SUCCESS: + ManageOfferSuccessResult success; +default: + void; +}; + /******* SetOptions Result ********/ enum SetOptionsResultCode { // codes considered as "success" for the operation @@ -563,11 +616,11 @@ CHANGE_TRUST_NO_ISSUER = -2, // could not find issuer CHANGE_TRUST_INVALID_LIMIT = -3, // cannot drop limit below balance // cannot create with a limit of 0 CHANGE_TRUST_LOW_RESERVE = -4, // not enough funds to create a new trust line, - CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed + CHANGE_TRUST_SELF_NOT_ALLOWED = -5 // trusting self is not allowed }; union ChangeTrustResult switch (ChangeTrustResultCode code) { case CHANGE_TRUST_SUCCESS: @@ -693,11 +746,13 @@ { opINNER = 0, // inner object result is valid opBAD_AUTH = -1, // too few valid signatures / wrong network opNO_ACCOUNT = -2, // source account was not found - opNOT_SUPPORTED = -3 // operation not supported at this time + opNOT_SUPPORTED = -3, // operation not supported at this time + opTOO_MANY_SUBENTRIES = -4, // max number of subentries already reached + opEXCEEDED_WORK_LIMIT = -5 // operation did too much work }; union OperationResult switch (OperationResultCode code) { case opINNER: @@ -707,14 +762,14 @@ CreateAccountResult createAccountResult; case PAYMENT: PaymentResult paymentResult; case PATH_PAYMENT: PathPaymentResult pathPaymentResult; - case MANAGE_OFFER: - ManageOfferResult manageOfferResult; - case CREATE_PASSIVE_OFFER: - ManageOfferResult createPassiveOfferResult; + case MANAGE_SELL_OFFER: + ManageSellOfferResult manageSellOfferResult; + case CREATE_PASSIVE_SELL_OFFER: + ManageSellOfferResult createPassiveSellOfferResult; case SET_OPTIONS: SetOptionsResult setOptionsResult; case CHANGE_TRUST: ChangeTrustResult changeTrustResult; case ALLOW_TRUST: @@ -725,9 +780,11 @@ InflationResult inflationResult; case MANAGE_DATA: ManageDataResult manageDataResult; case BUMP_SEQUENCE: BumpSequenceResult bumpSeqResult; + case MANAGE_BUY_OFFER: + ManageBuyOfferResult manageBuyOfferResult; } tr; default: void; };