ain icon indicating copy to clipboard operation
ain copied to clipboard

DUSDLock Smartcontract

Open kuegi opened this issue 3 years ago • 8 comments

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

Implementation for DFIP 2211-D: https://github.com/DeFiCh/dfips/issues/236

Additional comments?:

kuegi avatar Nov 21 '22 20:11 kuegi

This is really great work and super appreciate the effort to get this in. But really wouldn't rush this -- would be better to have get some mind space to think about how to actually implement this cleanly.

Today it's lock 1 and lock 2, what if we need a different variant. It would be better to think through this some more before setting this in stone as a part of an immutable blockchain.

prasannavl avatar Nov 22 '22 10:11 prasannavl

@kuegi Nice work. I'll write comments on the questions you asked in the code comments and necessary modifications.

Mixa84 avatar Nov 23 '22 09:11 Mixa84

I'll write comments on the questions you asked in the code comments and necessary modifications.

@Mixa84 thx. but its still WIP. since I didn't have a env setup its lots of small things not working out yet. Today I finally set it up and will refactor a bit (since we decided to not squeeze it into v3). So maybe wait till tomorrow, then the state of the branch will be much better (with tests and all)

kuegi avatar Nov 23 '22 10:11 kuegi

I'll write comments on the questions you asked in the code comments and necessary modifications.

@Mixa84 thx. but its still WIP. since I didn't have a env setup its lots of small things not working out yet. Today I finally set it up and will refactor a bit (since we decided to not squeeze it into v3). So maybe wait till tomorrow, then the state of the branch will be much better (with tests and all)

I've added some stuff I saw currently and it will maybe help you in the refactor. If you already addressed those just resolve it ;)

Mixa84 avatar Nov 23 '22 10:11 Mixa84

I'll write comments on the questions you asked in the code comments and necessary modifications.

@Mixa84 thx. but its still WIP. since I didn't have a env setup its lots of small things not working out yet. Today I finally set it up and will refactor a bit (since we decided to not squeeze it into v3). So maybe wait till tomorrow, then the state of the branch will be much better (with tests and all)

I've added some stuff I saw currently and it will maybe help you in the refactor. If you already addressed those just resolve it ;)

thx a lot. adapted the code and logic. Now using a more generic approach so the attributes can define what lockperiods are available and which token is used (so no need to hardcode the token key now).

Not sure if the way I did the attribute keys is good or complete crap.

More tests are likely better, also to split the test function into more smaller tests. But at least they are green now ;)

kuegi avatar Nov 23 '22 22:11 kuegi

I am thinking about switching the logic from "lockTime" to "batchId". cause in the end, that number is random. So we could build it with logic that there are batches in this smartcontract. Each batch would have

  • associated lockToken
  • limit how much DUSD can be swapped
  • blockheight when withdrawal/swap back is possible

Any thoughts on that? @Mixa84 @prasannavl

kuegi avatar Nov 24 '22 16:11 kuegi

@Mixa84 Thank you very much for the comments. I tried to implement all of them.

kuegi avatar Dec 01 '22 19:12 kuegi

@Mixa84 @prasannavl anything left for me to do here?

kuegi avatar Dec 12 '22 18:12 kuegi

Closing stale PRs. No longer relevant.

prasannavl avatar Jul 15 '24 19:07 prasannavl