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

MESH-1271: Implement Capital Distributions #716

Merged
merged 15 commits into from Nov 9, 2020
Merged

MESH-1271: Implement Capital Distributions #716

merged 15 commits into from Nov 9, 2020

Conversation

@Centril
Copy link
Contributor

@Centril Centril commented Nov 3, 2020

Based on #705.

Tests will be added in a different follow-up PR.

Also resolves https://polymath.atlassian.net/browse/MESH-1336.

pallets/corporate-actions/src/ballot.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
@Centril Centril force-pushed the mesh-1271 branch from 571cf0d to 65d7af8 Nov 4, 2020
@Centril Centril changed the title [WIP] MESH-1271: Implement Capital Distributions MESH-1271: Implement Capital Distributions Nov 5, 2020
@Centril Centril requested a review from vkomenda Nov 5, 2020
Copy link
Member

@satyamakgec satyamakgec left a comment

There are some places in the corporate-actions/lib.rs where there is a typo for the WithholdingTaxsuffix in storage.

pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
ensure!(!expired(expires_at, payment_at), Error::<T>::ExpiryBeforePayment);

// Ensure `now <= payment_at`.
ensure!(<Checkpoint<T>>::now_unix() <= payment_at, Error::<T>::NowAfterPayment);

This comment has been minimized.

@satyamakgec

satyamakgec Nov 5, 2020
Member

I think it should be < only

This comment has been minimized.

@Centril

Centril Nov 5, 2020
Author Contributor

I believe now <= start is generally consistent with what we use elsewhere, e.g., record_date <= start.
Moreover, there's no harm with being inclusive re. current time rather than requiring a strict relation.

This comment has been minimized.

@satyamakgec

satyamakgec Nov 5, 2020
Member

I think then you have to make the same change for the remove_distribution() pallet. Where we are not allowing to remove at an inclusive time. I think as per the definition of payment_at user should able to withdraw its funds when now == payment_at.

This comment has been minimized.

@Centril

Centril Nov 5, 2020
Author Contributor

I don't think that follows. However, there's actually a bug (fixing) in ensure_active_distribution; should have been now >= dist.payment_at, not now > dist.payment_at, which is (part of) the definition of an active distribution. You should then only be able to remove a distribution if it isn't active yet, i.e. the complement of now >= dist.payment_at, i.e. !(now >= dist.payment_at) => now < dist.payment_at.

pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
pallets/corporate-actions/src/lib.rs Outdated Show resolved Hide resolved
@satyamakgec
Copy link
Member

@satyamakgec satyamakgec commented Nov 5, 2020

@Centril we are missing the test suite as well in this PR.

@Centril
Copy link
Contributor Author

@Centril Centril commented Nov 5, 2020

@Centril we are missing the test suite as well in this PR.

Following up with tests in a follow-up to this and the ballots PR.

@Centril Centril force-pushed the mesh-1271 branch from 7e5639d to 2309074 Nov 9, 2020
@Centril Centril requested a review from maxsam4 Nov 9, 2020
@Centril Centril force-pushed the mesh-1271 branch from a8e13b8 to ca09f08 Nov 9, 2020
@maxsam4
maxsam4 approved these changes Nov 9, 2020
pallets/common/src/protocol_fee.rs Show resolved Hide resolved
pallets/corporate-actions/src/distribution.rs Outdated Show resolved Hide resolved
poly-auto-merge bot added 2 commits Nov 9, 2020
@poly-auto-merge poly-auto-merge bot merged commit 12c55f1 into develop Nov 9, 2020
5 checks passed
5 checks passed
auto-merge Merging
Details
WIP Ready for review
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
concourse-ci/status Concourse CI build success
Details
@Centril Centril deleted the mesh-1271 branch Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.