Conversation
add xCheddar lockup token upgrade cheddar to 4.0.0-pre 7 upgate fn migrate()
README.md
Outdated
|
|
||
| ## XCheddar token | ||
|
|
||
| Token which allows users stake their Cheddar tokens and get some rewards for it. Base model is the same as CRV and veCRV locked tokens model. After 30-days period distribution of rewards starts and it counting from monthly reward parameter. Locked token have a virtual price depends on amount of locked/minted XCheddar tokens |
There was a problem hiding this comment.
could you add a links to CRV and veCRV?
There was a problem hiding this comment.
@robert-zaremba yep, what’s required? I update all with ahead commits
There was a problem hiding this comment.
links to explain CRV and veCRV
neardev/dev-account.env
Outdated
| @@ -0,0 +1 @@ | |||
| CONTRACT_NAME=dev-1654515440352-14631167054094 No newline at end of file | |||
There was a problem hiding this comment.
I think we should add neardev to .gitignore
robert-zaremba
left a comment
There was a problem hiding this comment.
- let's don't include the compiled wasm code
- the math for redeeming xCheddar is not clear (see the comments)
- timestamp in seconds should be u64, not u32.
- add docs about msg parameter for
ft_transfer_callhandler (ft_on_transfer)
cheddar/Cargo.toml
Outdated
| serde_json = "*" | ||
| near-sdk = { git = "https://github.com/near/near-sdk-rs", tag="3.1.0" } | ||
| near-contract-standards = { git = "https://github.com/near/near-sdk-rs", tag="3.1.0" } | ||
| near-sdk = "4.0.0-pre.7" |
There was a problem hiding this comment.
| near-sdk = "4.0.0-pre.7" | |
| near-sdk = "4.0.0" |
There was a problem hiding this comment.
v4 is already released, let's don't use -pre
There was a problem hiding this comment.
we can already use v4.1.0-pre
cheddar/Cargo.toml
Outdated
| near-contract-standards = { git = "https://github.com/near/near-sdk-rs", tag="3.1.0" } | ||
| near-sdk = "4.0.0-pre.7" | ||
| near-sys = "0.1.0" | ||
| near-contract-standards = "4.0.0-pre.7" |
There was a problem hiding this comment.
| near-contract-standards = "4.0.0-pre.7" | |
| near-contract-standards = "4.0.0" |
cheddar/Cargo.toml
Outdated
| [dev-dependencies] | ||
| # near-primitives = { git = "https://github.com/nearprotocol/nearcore.git" } | ||
| # near-sdk-sim = { git = "https://github.com/near/near-sdk-rs.git", version="v3.1.0" } | ||
| near-sdk-sim = "4.0.0-pre.7" |
There was a problem hiding this comment.
| near-sdk-sim = "4.0.0-pre.7" | |
| near-sdk-sim = "4.0.0" |
cheddar/README.md
Outdated
| ``` | ||
| rustup target add wasm32-unknown-unknown | ||
| RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release | ||
| cp target/wasm32-unknown-unknown/release/cheddar_coin.wasm res/cheddar_coin.wasm |
There was a problem hiding this comment.
we have this in Makefile. Let's use make instruction here.
| self.assert_owner(); | ||
| self.owner_id = owner_id.as_ref().clone(); | ||
| assert!( | ||
| env::is_valid_account_id(owner_id.as_bytes()), |
There was a problem hiding this comment.
I think we don't need to validate, AccountId should be validated automatically
There was a problem hiding this comment.
AFIAK, v4 validates account automatically
| } | ||
|
|
||
| // return the amount of to be distribute reward this time | ||
| pub(crate) fn try_distribute_reward(&self, cur_timestamp_in_sec: u32) -> Balance { |
There was a problem hiding this comment.
| pub(crate) fn try_distribute_reward(&self, cur_timestamp_in_sec: u32) -> Balance { | |
| pub(crate) fn compute_distribute_reward(&self, cur_timestamp_in_sec: u32) -> Balance { |
xcheddar/src/xcheddar.rs
Outdated
| self.internal_stake(&sender_id, amount); | ||
| PromiseOrValue::Value(U128(0)) | ||
| } else { | ||
| // deposit reward |
There was a problem hiding this comment.
let's use a specific message for making reward desposits. Eg msg: "reward deposit" - otherwise users may run into troubles.
Also update the docs about that.
| total_reward += to_yocto("100"); | ||
|
|
||
| let xcheddar_info0 = view!(xcheddar_contract.contract_metadata()).unwrap_json::<ContractMetadata>(); | ||
| assert_xcheddar(&xcheddar_info0, to_yocto("100"), 0, 0); |
There was a problem hiding this comment.
| assert_xcheddar(&xcheddar_info0, to_yocto("100"), 0, 0); | |
| assert_xcheddar(&xcheddar_info0, total_reward, 0, 0); |
|
@robert-zaremba can we finalize and merge, so front-end devs can start work? |
| self.assert_owner(); | ||
| self.owner_id = owner_id.as_ref().clone(); | ||
| assert!( | ||
| env::is_valid_account_id(owner_id.as_bytes()), |
There was a problem hiding this comment.
AFIAK, v4 validates account automatically
| ext_ft_resolver::ext(env::current_account_id()) | ||
| .with_static_gas(GAS_FOR_RESOLVE_TRANSFER) | ||
| .ft_resolve_transfer(sender_id, receiver_id, amount.into()), | ||
| ) |
There was a problem hiding this comment.
if we want to update to a new API, then let's remove the previous version. Although I would keep the original and only do minimal changes to already deployed token.
| } | ||
| return used_amount.into(); | ||
| } | ||
| } |
There was a problem hiding this comment.
As I correctly remember I do this because of new standards version
| @@ -0,0 +1,74 @@ | |||
| # P3 (NFT versioned) explanation | |||
There was a problem hiding this comment.
shall we call it p4-farm-nft? We already have p3 farm, and it's working totally differently.
add xCheddar lockup token
upgrade cheddar to 4.0.0-pre 7
upgate fn migrate()