Improved display format for transfer fee

This commit is contained in:
Jesse C. Fisher 2023-11-11 16:38:48 +00:00
parent b696190181
commit 1eefcb36f4
3 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,12 @@
class Token < ActiveRecord::Base class Token < ActiveRecord::Base
enum standard: [:dip20, :icrc1, :unknown] enum standard: [:dip20, :icrc1, :unknown]
validates :canister_id, presence: true, uniqueness: true validates :canister_id, presence: true, uniqueness: true
def transfer_fee_to_f
if self.transfer_fee.present?
return self.transfer_fee/(10.0**self.decimals)
else
return nil
end
end
end end

View File

@ -34,7 +34,7 @@
%td= token.name %td= token.name
%td= token.total_supply %td= token.total_supply
%td= token.decimals %td= token.decimals
%td= token.transfer_fee %td= token.transfer_fee_to_f
- if policy(token).update? - if policy(token).update?
%td= link_to 'Show', token %td= link_to 'Show', token
%td= link_to 'Edit', edit_token_path(token) %td= link_to 'Edit', edit_token_path(token)

View File

@ -31,7 +31,5 @@
= @token.decimals = @token.decimals
%p %p
%b Transfer fee: %b Transfer fee:
- begin = @token.transfer_fee_to_f
= @token.transfer_fee/(10.0**@token.decimals)
- rescue