Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reissuable Token AR #52

Merged
merged 15 commits into from
May 27, 2021
4 changes: 2 additions & 2 deletions lib/glueby/contract/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def to_payload
def self.parse_from_payload(payload)
color_id, script_pubkey = payload.unpack('a33a*')
color_id = Tapyrus::Color::ColorIdentifier.parse_from_payload(color_id)
script_pubkey = Tapyrus::Script.parse_from_payload(script_pubkey) if script_pubkey
if !Glueby::Contract::AR::ReissuableToken.saved?(color_id.to_hex) && script_pubkey.present?
if color_id.type == Tapyrus::Color::TokenTypes::REISSUABLE && !script_pubkey.empty?
rantan marked this conversation as resolved.
Show resolved Hide resolved
script_pubkey = Tapyrus::Script.parse_from_payload(script_pubkey)
Glueby::Contract::AR::ReissuableToken.create!(color_id: color_id.to_hex, script_pubkey: script_pubkey.to_hex)
end
new(color_id: color_id)
Expand Down