Giter VIP home page Giter VIP logo

cheddar-auction's People

Contributors

marcel-krsh avatar rodrigocsolari avatar

Watchers

 avatar  avatar

Forkers

yellingoilbird

cheddar-auction's Issues

Auction #1 review

assert!(deposit > 0, "Attached deposit must be greater than 0");

use assert_one_yocto() in top of function instead

assert_eq!(ft_token_id, "near", "Cannot pay offer with near.");

did you mean - "only NEAR allows"? Cause, you are checking that token_id must be equal to NEAR every time.

const FIVE_MINS : u64 = 5 * 60 * 1000;

if (sale.end_at - FIVE_MINS) < now {

which time it is measured? Cause now to sec = (env::block_timestamp() / 1_000_000_000) as u32 and FIVE_MINS should be equal to FIVE_MIN_IN_SEC: u32 = 5 * 60;. You are using now as seconds and FIVE_MINS const as milliseconds

pub fn accept_offer(

who can accept an offer( this func)? Only bid owner? Or only NFT owner? It comes to private resolving, need to add assert check
Also - its payable and needs to attach some deposit to call promises, for example with ft_transfers. This func starts a cascade of promises with payouts and transfer and must be payable.

Should panic if it calls not by owner_id

let sale = self.internal_remove_sale(nft_contract_id.into(), token_id);

self.sales.insert(&contract_and_token_id, &sale);

Should we wait till the Promise before updating sale info? Cause if Promise for purchase was failed we are have removed the unsuccessful bid and not correct updated Sale info.
fn refund_bids(

Maybe split bids to FT and NEAR? Cause some logic comes with token_id as String, did you validate this anywhere? Token_id as String comes into functions and after this goes like clone() object into bids. Check this. Also in ft_on_transfer you are comparing string and AccountId - token_id = env::predeccessor_account_id() to sale.token_type: String

Auction #2 review

  • HashMap is good and works fine, but for all state changes operations requirement is paid (resourses, processing time) and using HashMap has less efficiently using. Inside the ContractState all keys for HashMap elements will be store into Contract at separative Object(keys) and will be Serialize-Deserialize for each call. We don’t need Serialize-Deserialize processes to whole map, we need just one element taking per Payout call. I propose to use UnorderedMap instead of HashMap:

pub bids: HashMap<FungibleTokenId, Vec<Bid>>,

pub type Payout = HashMap<AccountId, U128>;

  • How storage_management realized? Why it removed, v1_cheddar_auction.testnet (which last updated as I see) didn’t have any StorageManagement?

  • better using env::predecessor_id() its more efficiently because of less size of msg parsed and can be compared in asserts without calling as_ref() or to_string()

    let SaleArgs { period, token_type, price, nft_contract_id } =

first time -

let created_at = env::block_timestamp() / 1000000;

second time -
created_at: U64(env::block_timestamp()/1000000),

same operations double times

bids.push(new_bid);

what if it will be 257-th bid? (u8::MAX)

use like this:

if bids.len() + 1 > self.bid_history_length as usize {
   bids.remove(0);
};
//and then:
bids.push(new_bid);
  • How about gas? FT transfer get 5Tgas, each callback - 5Tgas. What if it will be more than 20 accounts to refund FTs, for example? Or it covered on front-end?

  • Here you are have limit - max payouts is 10


    Why you are remove check for this at callbacks? If it will be more than 10 payout accounts (I think if we are use FTs more than 7-8) it panics with “Exceeded prepaid Gas”. And refunds actions can go bad in that case:
    self.refund_bids(sale.bids);

  • Where it used, or will be? -> payout.with_cheddar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.