eth-erc721

ERC-721 'NFT' token interface with example developer badge token contract
Log | Files | Refs | LICENSE

commit 24c707e60904409e68e22d8546dea8f73447c4b9
parent 569d014e18251ec2bb1b3412b104e21504e30945
Author: nolash <dev@holbrook.no>
Date:   Fri,  7 May 2021 21:56:29 +0200

Add mint test

Diffstat:
Mpython/eth_devbadge/data/BadgeToken.bin | 4++--
Mpython/eth_devbadge/token.py | 14++++++++++++++
Mpython/tests/test_app.py | 9++++++++-
Msolidity/BadgeToken.sol | 2+-
4 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/python/eth_devbadge/data/BadgeToken.bin b/python/eth_devbadge/data/BadgeToken.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b50604051620025953803806200259583398181016040528101906200003791906200022c565b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600c9080519060200190620000d0929190620000f3565b5080600d9080519060200190620000e9929190620000f3565b5050505062000472565b82805462000101906200037d565b90600052602060002090601f01602090048101928262000125576000855562000171565b82601f106200014057805160ff191683800117855562000171565b8280016001018555821562000171579182015b828111156200017057825182559160200191906001019062000153565b5b50905062000180919062000184565b5090565b5b808211156200019f57600081600090555060010162000185565b5090565b6000620001ba620001b484620002dd565b620002b4565b905082815260208101848484011115620001d357600080fd5b620001e084828562000347565b509392505050565b600081519050620001f98162000458565b92915050565b600082601f8301126200021157600080fd5b815162000223848260208601620001a3565b91505092915050565b6000806000606084860312156200024257600080fd5b60006200025286828701620001e8565b935050602084015167ffffffffffffffff8111156200027057600080fd5b6200027e86828701620001ff565b925050604084015167ffffffffffffffff8111156200029c57600080fd5b620002aa86828701620001ff565b9150509250925092565b6000620002c0620002d3565b9050620002ce8282620003b3565b919050565b6000604051905090565b600067ffffffffffffffff821115620002fb57620002fa62000418565b5b620003068262000447565b9050602081019050919050565b6000620003208262000327565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60005b83811015620003675780820151818401526020810190506200034a565b8381111562000377576000848401525b50505050565b600060028204905060018216806200039657607f821691505b60208210811415620003ad57620003ac620003e9565b5b50919050565b620003be8262000447565b810181811067ffffffffffffffff82111715620003e057620003df62000418565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b620004638162000313565b81146200046f57600080fd5b50565b61211380620004826000396000f3fe608060405260043610610131576000357c0100000000000000000000000000000000000000000000000000000000900480634f6ccce7116100bd57806395d89b411161008157806395d89b41146103e1578063a22cb4651461040c578063b88d4fde14610435578063e985e9c514610451578063f1b0aa151461048e57610131565b80634f6ccce7146102d45780636352211e1461031157806370a082311461034e5780638da5cb5b1461038b57806392088cf6146103b657610131565b806318160ddd1161010457806318160ddd146101f757806323b872dd146102225780632f745c591461023e57806342842e0e1461027b578063449a52f81461029757610131565b806301ffc9a71461013657806306fdde0314610173578063081812fc1461019e578063095ea7b3146101db575b600080fd5b34801561014257600080fd5b5061015d60048036038101906101589190611bf2565b6104cb565b60405161016a9190611cd4565b60405180910390f35b34801561017f57600080fd5b50610188610676565b6040516101959190611d0a565b60405180910390f35b3480156101aa57600080fd5b506101c560048036038101906101c09190611c1b565b610704565b6040516101d29190611cb9565b60405180910390f35b6101f560048036038101906101f09190611bb6565b610741565b005b34801561020357600080fd5b5061020c61085d565b6040516102199190611d2c565b60405180910390f35b61023c60048036038101906102379190611ab0565b61086a565b005b34801561024a57600080fd5b5061026560048036038101906102609190611bb6565b6108d9565b6040516102729190611d2c565b60405180910390f35b61029560048036038101906102909190611ab0565b6109b0565b005b3480156102a357600080fd5b506102be60048036038101906102b99190611bb6565b610a1f565b6040516102cb9190611cd4565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f69190611c1b565b610cd3565b6040516103089190611d2c565b60405180910390f35b34801561031d57600080fd5b5061033860048036038101906103339190611c1b565b610d21565b6040516103459190611cb9565b60405180910390f35b34801561035a57600080fd5b5061037560048036038101906103709190611a4b565b610d5e565b6040516103829190611d2c565b60405180910390f35b34801561039757600080fd5b506103a0610da7565b6040516103ad9190611cb9565b60405180910390f35b3480156103c257600080fd5b506103cb610dcd565b6040516103d89190611cb9565b60405180910390f35b3480156103ed57600080fd5b506103f6610df1565b6040516104039190611d0a565b60405180910390f35b34801561041857600080fd5b50610433600480360381019061042e9190611b7a565b610e7f565b005b61044f600480360381019061044a9190611aff565b611122565b005b34801561045d57600080fd5b5061047860048036038101906104739190611a74565b61126c565b6040516104859190611cd4565b60405180910390f35b34801561049a57600080fd5b506104b560048036038101906104b09190611c1b565b611304565b6040516104c29190611d2c565b60405180910390f35b60006380ac58cd7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105205760019050610671565b635b5e139f7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105735760019050610671565b63780e9d637c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105c65760019050610671565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156106195760019050610671565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561066c5760019050610671565b600090505b919050565b600c805461068390611ed7565b80601f01602080910402602001604051908101604052809291908181526020018280546106af90611ed7565b80156106fc5780601f106106d1576101008083540402835291602001916106fc565b820191906000526020600020905b8154815290600101906020018083116106df57829003601f168201915b505050505081565b60006009600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ac57600080fd5b816009600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000600280549050905090565b60606108788484848461136a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821061092657600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061099d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b60606109be8484848461136a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7b57600080fd5b6000600460008481526020019081526020016000205414610a9b57600080fd5b600080600280549050915083905060028190806001815401808255809150506001900390600052602060002001600090919091909150556003439080600181540180825580915050600190039060005260206000200160009091909190915055846005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360076000600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050815260200190815260200160002081905550600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020849080600181540180825580915050600190039060005260206000200160009091909190915055600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610c5d90611f3a565b91905055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f886604051610cbf9190611d2c565b60405180910390a360019250505092915050565b600060028281548110610d0f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b60006005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d8054610dfe90611ed7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e2a90611ed7565b8015610e775780601f10610e4c57610100808354040283529160200191610e77565b820191906000526020600020905b815481529060010190602001808311610e5a57829003601f168201915b505050505081565b8015610fa057600073ffffffffffffffffffffffffffffffffffffffff16600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f1d57600080fd5b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506110b9565b600073ffffffffffffffffffffffffffffffffffffffff16600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561103957600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111169190611cd4565b60405180910390a35050565b61112e8484848461136a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f75c9e114f073c346aac7d1d7e9a3c3c14edabcdd27de07d1d9e425f45d318c5e600b60008781526020019081526020016000206001600b60008981526020019081526020016000208054905061120f9190611db9565b81548110611246577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015460405161125e9190611cef565b60405180910390a450505050565b60008173ffffffffffffffffffffffffffffffffffffffff16600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b6000806004600084815260200190815260200160002054905060038181548110611357577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154915050919050565b60006005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508473ffffffffffffffffffffffffffffffffffffffff166005600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461140d57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611541573373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061153757503373ffffffffffffffffffffffffffffffffffffffff16600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61154057600080fd5b5b60006009600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506116229190611db9565b81548110611659577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206007600086815260200190815260200160002054815481106116ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061174c90611ead565b9190505550600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020839080600181540180825580915050600190039060005260206000200160009091909190915055600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061180790611f3a565b9190505550836005600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b8251811015611987578281815181106118a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916600b600086815260200190815260200160002060208361192f9190611f83565b81548110611966577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550808061197f90611f3a565b915050611861565b505050505050565b60006119a261199d84611d6c565b611d47565b9050828152602081018484840111156119ba57600080fd5b6119c5848285611e6b565b509392505050565b6000813590506119dc81612081565b92915050565b6000813590506119f181612098565b92915050565b600081359050611a06816120af565b92915050565b600082601f830112611a1d57600080fd5b8135611a2d84826020860161198f565b91505092915050565b600081359050611a45816120c6565b92915050565b600060208284031215611a5d57600080fd5b6000611a6b848285016119cd565b91505092915050565b60008060408385031215611a8757600080fd5b6000611a95858286016119cd565b9250506020611aa6858286016119cd565b9150509250929050565b600080600060608486031215611ac557600080fd5b6000611ad3868287016119cd565b9350506020611ae4868287016119cd565b9250506040611af586828701611a36565b9150509250925092565b60008060008060808587031215611b1557600080fd5b6000611b23878288016119cd565b9450506020611b34878288016119cd565b9350506040611b4587828801611a36565b925050606085013567ffffffffffffffff811115611b6257600080fd5b611b6e87828801611a0c565b91505092959194509250565b60008060408385031215611b8d57600080fd5b6000611b9b858286016119cd565b9250506020611bac858286016119e2565b9150509250929050565b60008060408385031215611bc957600080fd5b6000611bd7858286016119cd565b9250506020611be885828601611a36565b9150509250929050565b600060208284031215611c0457600080fd5b6000611c12848285016119f7565b91505092915050565b600060208284031215611c2d57600080fd5b6000611c3b84828501611a36565b91505092915050565b611c4d81611ded565b82525050565b611c5c81611dff565b82525050565b611c6b81611e0b565b82525050565b6000611c7c82611d9d565b611c868185611da8565b9350611c96818560208601611e7a565b611c9f81612070565b840191505092915050565b611cb381611e61565b82525050565b6000602082019050611cce6000830184611c44565b92915050565b6000602082019050611ce96000830184611c53565b92915050565b6000602082019050611d046000830184611c62565b92915050565b60006020820190508181036000830152611d248184611c71565b905092915050565b6000602082019050611d416000830184611caa565b92915050565b6000611d51611d62565b9050611d5d8282611f09565b919050565b6000604051905090565b600067ffffffffffffffff821115611d8757611d86612041565b5b611d9082612070565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000611dc482611e61565b9150611dcf83611e61565b925082821015611de257611de1611fb4565b5b828203905092915050565b6000611df882611e41565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015611e98578082015181840152602081019050611e7d565b83811115611ea7576000848401525b50505050565b6000611eb882611e61565b91506000821415611ecc57611ecb611fb4565b5b600182039050919050565b60006002820490506001821680611eef57607f821691505b60208210811415611f0357611f02612012565b5b50919050565b611f1282612070565b810181811067ffffffffffffffff82111715611f3157611f30612041565b5b80604052505050565b6000611f4582611e61565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f7857611f77611fb4565b5b600182019050919050565b6000611f8e82611e61565b9150611f9983611e61565b925082611fa957611fa8611fe3565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b61208a81611ded565b811461209557600080fd5b50565b6120a181611dff565b81146120ac57600080fd5b50565b6120b881611e15565b81146120c357600080fd5b50565b6120cf81611e61565b81146120da57600080fd5b5056fea2646970667358221220ec8c2304ba3304f64a599e11d17f4e6846f6308e7446df317179c17b3220f7a764736f6c63430008030033 -\ No newline at end of file +60806040523480156200001157600080fd5b50604051620025a5380380620025a583398181016040528101906200003791906200022c565b826000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600c9080519060200190620000d0929190620000f3565b5080600d9080519060200190620000e9929190620000f3565b5050505062000472565b82805462000101906200037d565b90600052602060002090601f01602090048101928262000125576000855562000171565b82601f106200014057805160ff191683800117855562000171565b8280016001018555821562000171579182015b828111156200017057825182559160200191906001019062000153565b5b50905062000180919062000184565b5090565b5b808211156200019f57600081600090555060010162000185565b5090565b6000620001ba620001b484620002dd565b620002b4565b905082815260208101848484011115620001d357600080fd5b620001e084828562000347565b509392505050565b600081519050620001f98162000458565b92915050565b600082601f8301126200021157600080fd5b815162000223848260208601620001a3565b91505092915050565b6000806000606084860312156200024257600080fd5b60006200025286828701620001e8565b935050602084015167ffffffffffffffff8111156200027057600080fd5b6200027e86828701620001ff565b925050604084015167ffffffffffffffff8111156200029c57600080fd5b620002aa86828701620001ff565b9150509250925092565b6000620002c0620002d3565b9050620002ce8282620003b3565b919050565b6000604051905090565b600067ffffffffffffffff821115620002fb57620002fa62000418565b5b620003068262000447565b9050602081019050919050565b6000620003208262000327565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60005b83811015620003675780820151818401526020810190506200034a565b8381111562000377576000848401525b50505050565b600060028204905060018216806200039657607f821691505b60208210811415620003ad57620003ac620003e9565b5b50919050565b620003be8262000447565b810181811067ffffffffffffffff82111715620003e057620003df62000418565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b620004638162000313565b81146200046f57600080fd5b50565b61212380620004826000396000f3fe608060405260043610610131576000357c0100000000000000000000000000000000000000000000000000000000900480634f6ccce7116100bd57806395d89b411161008157806395d89b41146103e1578063a22cb4651461040c578063b88d4fde14610435578063e985e9c514610451578063f1b0aa151461048e57610131565b80634f6ccce7146102d45780636352211e1461031157806370a082311461034e5780638da5cb5b1461038b57806392088cf6146103b657610131565b806318160ddd1161010457806318160ddd146101f757806323b872dd146102225780632f745c591461023e57806342842e0e1461027b578063449a52f81461029757610131565b806301ffc9a71461013657806306fdde0314610173578063081812fc1461019e578063095ea7b3146101db575b600080fd5b34801561014257600080fd5b5061015d60048036038101906101589190611c02565b6104cb565b60405161016a9190611ce4565b60405180910390f35b34801561017f57600080fd5b50610188610676565b6040516101959190611d1a565b60405180910390f35b3480156101aa57600080fd5b506101c560048036038101906101c09190611c2b565b610704565b6040516101d29190611cc9565b60405180910390f35b6101f560048036038101906101f09190611bc6565b610741565b005b34801561020357600080fd5b5061020c61085d565b6040516102199190611d3c565b60405180910390f35b61023c60048036038101906102379190611ac0565b61086a565b005b34801561024a57600080fd5b5061026560048036038101906102609190611bc6565b6108d9565b6040516102729190611d3c565b60405180910390f35b61029560048036038101906102909190611ac0565b6109b0565b005b3480156102a357600080fd5b506102be60048036038101906102b99190611bc6565b610a1f565b6040516102cb9190611ce4565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f69190611c2b565b610ce3565b6040516103089190611d3c565b60405180910390f35b34801561031d57600080fd5b5061033860048036038101906103339190611c2b565b610d31565b6040516103459190611cc9565b60405180910390f35b34801561035a57600080fd5b5061037560048036038101906103709190611a5b565b610d6e565b6040516103829190611d3c565b60405180910390f35b34801561039757600080fd5b506103a0610db7565b6040516103ad9190611cc9565b60405180910390f35b3480156103c257600080fd5b506103cb610ddd565b6040516103d89190611cc9565b60405180910390f35b3480156103ed57600080fd5b506103f6610e01565b6040516104039190611d1a565b60405180910390f35b34801561041857600080fd5b50610433600480360381019061042e9190611b8a565b610e8f565b005b61044f600480360381019061044a9190611b0f565b611132565b005b34801561045d57600080fd5b5061047860048036038101906104739190611a84565b61127c565b6040516104859190611ce4565b60405180910390f35b34801561049a57600080fd5b506104b560048036038101906104b09190611c2b565b611314565b6040516104c29190611d3c565b60405180910390f35b60006380ac58cd7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105205760019050610671565b635b5e139f7c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105735760019050610671565b63780e9d637c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156105c65760019050610671565b63449a52f87c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156106195760019050610671565b6301ffc9a77c010000000000000000000000000000000000000000000000000000000002827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561066c5760019050610671565b600090505b919050565b600c805461068390611ee7565b80601f01602080910402602001604051908101604052809291908181526020018280546106af90611ee7565b80156106fc5780601f106106d1576101008083540402835291602001916106fc565b820191906000526020600020905b8154815290600101906020018083116106df57829003601f168201915b505050505081565b60006009600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff166005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ac57600080fd5b816009600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000600280549050905090565b60606108788484848461137a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821061092657600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061099d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b60606109be8484848461137a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a450505050565b60003373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7b57600080fd5b600060046000848152602001908152602001600020541480610aa257506000600280549050145b610aab57600080fd5b600080600280549050915083905060028190806001815401808255809150506001900390600052602060002001600090919091909150556003439080600181540180825580915050600190039060005260206000200160009091909190915055846005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360076000600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050815260200190815260200160002081905550600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020849080600181540180825580915050600190039060005260206000200160009091909190915055600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610c6d90611f4a565b91905055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fab8530f87dc9b59234c4623bf917212bb2536d647574c8e7e5da92c2ede0c9f886604051610ccf9190611d3c565b60405180910390a360019250505092915050565b600060028281548110610d1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b60006005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d8054610e0e90611ee7565b80601f0160208091040260200160405190810160405280929190818152602001828054610e3a90611ee7565b8015610e875780601f10610e5c57610100808354040283529160200191610e87565b820191906000526020600020905b815481529060010190602001808311610e6a57829003601f168201915b505050505081565b8015610fb057600073ffffffffffffffffffffffffffffffffffffffff16600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f2d57600080fd5b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506110c9565b600073ffffffffffffffffffffffffffffffffffffffff16600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561104957600080fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111269190611ce4565b60405180910390a35050565b61113e8484848461137a565b818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4818373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f75c9e114f073c346aac7d1d7e9a3c3c14edabcdd27de07d1d9e425f45d318c5e600b60008781526020019081526020016000206001600b60008981526020019081526020016000208054905061121f9190611dc9565b81548110611256577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015460405161126e9190611cff565b60405180910390a450505050565b60008173ffffffffffffffffffffffffffffffffffffffff16600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b6000806004600084815260200190815260200160002054905060038181548110611367577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154915050919050565b60006005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508473ffffffffffffffffffffffffffffffffffffffff166005600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461141d57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611551573373ffffffffffffffffffffffffffffffffffffffff166009600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061154757503373ffffffffffffffffffffffffffffffffffffffff16600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61155057600080fd5b5b60006009600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506116329190611dc9565b81548110611669577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206007600086815260200190815260200160002054815481106116fe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061175c90611ebd565b9190505550600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020839080600181540180825580915050600190039060005260206000200160009091909190915055600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061181790611f4a565b9190505550836005600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060005b8251811015611997578281815181106118b3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916600b600086815260200190815260200160002060208361193f9190611f93565b81548110611976577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550808061198f90611f4a565b915050611871565b505050505050565b60006119b26119ad84611d7c565b611d57565b9050828152602081018484840111156119ca57600080fd5b6119d5848285611e7b565b509392505050565b6000813590506119ec81612091565b92915050565b600081359050611a01816120a8565b92915050565b600081359050611a16816120bf565b92915050565b600082601f830112611a2d57600080fd5b8135611a3d84826020860161199f565b91505092915050565b600081359050611a55816120d6565b92915050565b600060208284031215611a6d57600080fd5b6000611a7b848285016119dd565b91505092915050565b60008060408385031215611a9757600080fd5b6000611aa5858286016119dd565b9250506020611ab6858286016119dd565b9150509250929050565b600080600060608486031215611ad557600080fd5b6000611ae3868287016119dd565b9350506020611af4868287016119dd565b9250506040611b0586828701611a46565b9150509250925092565b60008060008060808587031215611b2557600080fd5b6000611b33878288016119dd565b9450506020611b44878288016119dd565b9350506040611b5587828801611a46565b925050606085013567ffffffffffffffff811115611b7257600080fd5b611b7e87828801611a1c565b91505092959194509250565b60008060408385031215611b9d57600080fd5b6000611bab858286016119dd565b9250506020611bbc858286016119f2565b9150509250929050565b60008060408385031215611bd957600080fd5b6000611be7858286016119dd565b9250506020611bf885828601611a46565b9150509250929050565b600060208284031215611c1457600080fd5b6000611c2284828501611a07565b91505092915050565b600060208284031215611c3d57600080fd5b6000611c4b84828501611a46565b91505092915050565b611c5d81611dfd565b82525050565b611c6c81611e0f565b82525050565b611c7b81611e1b565b82525050565b6000611c8c82611dad565b611c968185611db8565b9350611ca6818560208601611e8a565b611caf81612080565b840191505092915050565b611cc381611e71565b82525050565b6000602082019050611cde6000830184611c54565b92915050565b6000602082019050611cf96000830184611c63565b92915050565b6000602082019050611d146000830184611c72565b92915050565b60006020820190508181036000830152611d348184611c81565b905092915050565b6000602082019050611d516000830184611cba565b92915050565b6000611d61611d72565b9050611d6d8282611f19565b919050565b6000604051905090565b600067ffffffffffffffff821115611d9757611d96612051565b5b611da082612080565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000611dd482611e71565b9150611ddf83611e71565b925082821015611df257611df1611fc4565b5b828203905092915050565b6000611e0882611e51565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015611ea8578082015181840152602081019050611e8d565b83811115611eb7576000848401525b50505050565b6000611ec882611e71565b91506000821415611edc57611edb611fc4565b5b600182039050919050565b60006002820490506001821680611eff57607f821691505b60208210811415611f1357611f12612022565b5b50919050565b611f2282612080565b810181811067ffffffffffffffff82111715611f4157611f40612051565b5b80604052505050565b6000611f5582611e71565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415611f8857611f87611fc4565b5b600182019050919050565b6000611f9e82611e71565b9150611fa983611e71565b925082611fb957611fb8611ff3565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b61209a81611dfd565b81146120a557600080fd5b50565b6120b181611e0f565b81146120bc57600080fd5b50565b6120c881611e25565b81146120d357600080fd5b50565b6120df81611e71565b81146120ea57600080fd5b5056fea26469706673582212200bbe19f458108c1aff099be836757910e315386233d3d3043305de731d4736e464736f6c63430008030033 +\ No newline at end of file diff --git a/python/eth_devbadge/token.py b/python/eth_devbadge/token.py @@ -56,3 +56,17 @@ class BadgeToken(TxFactory): tx = self.template(sender_address, None, use_nonce=True) tx = self.set_code(tx, code) return self.finalize(tx, tx_format) + + + def mint_to(self, contract_address, sender_address, address, token_id, tx_format=TxFormat.JSONRPC): + enc = ABIContractEncoder() + enc.method('mintTo') + enc.typ(ABIContractType.ADDRESS) + enc.typ(ABIContractType.UINT256) + enc.address(address) + enc.uint256(token_id) + data = enc.get() + tx = self.template(sender_address, contract_address, use_nonce=True) + tx = self.set_code(tx, data) + tx = self.finalize(tx, tx_format) + return tx diff --git a/python/tests/test_app.py b/python/tests/test_app.py @@ -45,7 +45,14 @@ class Test(EthTesterCase): def test_mint(self): - pass + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = BadgeToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + (tx_hash_hex, o) = c.mint_to(self.address, self.accounts[0], self.accounts[1], int.from_bytes(b'\xee' * 32, byteorder='big')) + r = self.rpc.do(o) + + o = receipt(tx_hash_hex) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) if __name__ == '__main__': diff --git a/solidity/BadgeToken.sol b/solidity/BadgeToken.sol @@ -152,7 +152,7 @@ contract BadgeToken { // Minter function mintTo(address _beneficiary, uint256 _tokenId) external returns (bool) { require(owner == msg.sender); - require(tokenIndex[_tokenId] == 0x0); + require(tokenIndex[_tokenId] == 0x0 || token.length == 0); uint256 newTokenIndex; uint256 newTokenId;