Skip to content

ManageOffer creation - should we use 'Price' or 'takes', 'pays'? #573

Closed
@MonsieurNicolas

Description

Right now we manage offers following this pattern

struct ManageOfferOp
{
    Currency takerGets;
    Currency takerPays;
    int64 amount; // amount taker gets. if set to 0, delete the offer
    Price price;  // =takerPaysAmount/takerGetsAmount

    // 0=create a new offer, otherwise edit an existing offer
    uint64 offerID;
};

but so far many people seem confused about "Price" (me included), and can never remember when creating the offer if it's pays/gets or the inverse.

In the old code there used to be an amount for each direction, basically turning the contract into

struct ManageOfferOp
{
    Currency takerGets;
    int64 takerGetsAmount;  // amount taker gets. if set to 0, delete the offer
    Currency takerPays;
    int64 takerPaysAmount;

    // 0=create a new offer, otherwise edit an existing offer
    uint64 offerID;
};

We can even combine (currency, amount) into a struct and turn this into

struct ManageOfferOp
{
    Amount takerGets; // amount taker gets. if set to 0, delete the offer
    Amount takerPays;
    int64 takerPaysAmount;

    // 0=create a new offer, otherwise edit an existing offer
    uint64 offerID;
};

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions