Improved display format for transfer fee

This commit is contained in:
Jesse C. Fisher 2023-11-11 16:38:48 +00:00 committed by TheNeedful-DO
parent 0319932f28
commit 4ff1dcf179
3 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,12 @@
class Token < ActiveRecord::Base
enum standard: [:dip20, :icrc1, :unknown]
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

View File

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

View File

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