diff --git a/packages/evm/evmtest/wiki_how_tos/Allowance.abi b/packages/evm/evmtest/wiki_how_tos/Allowance.abi new file mode 100644 index 0000000000..33ab0b8b57 --- /dev/null +++ b/packages/evm/evmtest/wiki_how_tos/Allowance.abi @@ -0,0 +1,20 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_allowanceNFTID", + "type": "bytes32" + } + ], + "name": "allow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/packages/evm/evmtest/wiki_how_tos/Allowance.bin b/packages/evm/evmtest/wiki_how_tos/Allowance.bin new file mode 100644 index 0000000000..a22e774624 --- /dev/null +++ b/packages/evm/evmtest/wiki_how_tos/Allowance.bin @@ -0,0 +1 @@ +6080604052348015600e575f80fd5b506105f18061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063aab19db41461002d575b5f80fd5b61004760048036038101906100429190610204565b610049565b005b5f600167ffffffffffffffff81111561006557610064610242565b5b6040519080825280602002602001820160405280156100935781602001602082028036833780820191505090505b50905081815f815181106100aa576100a961026f565b5b6020026020010181815250506100be610149565b81816040018190525073107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663765f4f9e85836040518363ffffffff1660e01b815260040161011692919061058d565b5f604051808303815f87803b15801561012d575f80fd5b505af115801561013f573d5f803e3d5ffd5b5050505050505050565b60405180606001604052805f67ffffffffffffffff16815260200160608152602001606081525090565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101a082610177565b9050919050565b6101b081610196565b81146101ba575f80fd5b50565b5f813590506101cb816101a7565b92915050565b5f819050919050565b6101e3816101d1565b81146101ed575f80fd5b50565b5f813590506101fe816101da565b92915050565b5f806040838503121561021a57610219610173565b5b5f610227858286016101bd565b9250506020610238858286016101f0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6102a581610196565b82525050565b5f67ffffffffffffffff82169050919050565b6102c7816102ab565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610338826102f6565b6103428185610300565b9350610352818560208601610310565b61035b8161031e565b840191505092915050565b5f602083015f8301518482035f860152610380828261032e565b9150508091505092915050565b5f819050919050565b61039f8161038d565b82525050565b5f604083015f8301518482035f8601526103bf8282610366565b91505060208301516103d46020860182610396565b508091505092915050565b5f6103ea83836103a5565b905092915050565b5f602082019050919050565b5f610408826102cd565b61041281856102d7565b935083602082028501610424856102e7565b805f5b8581101561045f578484038952815161044085826103df565b945061044b836103f2565b925060208a01995050600181019050610427565b50829750879550505050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6104a4826101d1565b9050919050565b6104b48161049a565b82525050565b5f6104c583836104ab565b60208301905092915050565b5f602082019050919050565b5f6104e782610471565b6104f1818561047b565b93506104fc8361048b565b805f5b8381101561052c57815161051388826104ba565b975061051e836104d1565b9250506001810190506104ff565b5085935050505092915050565b5f606083015f83015161054e5f8601826102be565b506020830151848203602086015261056682826103fe565b9150506040830151848203604086015261058082826104dd565b9150508091505092915050565b5f6040820190506105a05f83018561029c565b81810360208301526105b28184610539565b9050939250505056fea2646970667358221220d9163190febf47bce5ab7ae60e6a6d172c5cdc41cf8babdab9acc537fdec5c5964736f6c634300081a0033 \ No newline at end of file diff --git a/packages/evm/evmtest/wiki_how_tos/Allowance.sol b/packages/evm/evmtest/wiki_how_tos/Allowance.sol new file mode 100644 index 0000000000..bf96e2e52a --- /dev/null +++ b/packages/evm/evmtest/wiki_how_tos/Allowance.sol @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +import "@iscmagic/ISC.sol"; + +contract allowance { + function takeAllowedFunds( + address _address, + bytes32 _allowanceNFTID + ) public { + NFTID[] memory nftIDs = new NFTID[](1); + nftIDs[0] = NFTID.wrap(_allowanceNFTID); + ISCAssets memory assets; + assets.nfts = nftIDs; + ISC.sandbox.takeAllowedFunds(_address, assets); + } +} diff --git a/packages/evm/evmtest/wiki_how_tos/GetBalance.bin b/packages/evm/evmtest/wiki_how_tos/GetBalance.bin index a1349b6c02..8102b333cd 100644 --- a/packages/evm/evmtest/wiki_how_tos/GetBalance.bin +++ b/packages/evm/evmtest/wiki_how_tos/GetBalance.bin @@ -1 +1 @@ -6080604052348015600e575f80fd5b50610ab28061001c5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c806319a5506a1461004e57806341d9834c1461005857806390cdadcd14610074578063cdfd0a661461007e575b5f80fd5b610056610088565b005b610072600480360381019061006d91906106a2565b6101d9565b005b61007c610340565b005b610086610404565b005b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa1580156100e5573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061010d91906107c2565b90505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630d90ec7b836040518263ffffffff1660e01b815260040161015d9190610882565b602060405180830381865afa158015610178573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061019c91906108d5565b90507f52c249d568f18754049ea99591153f1f0ad8c7ab03a3bcdcf8454bc274e54101816040516101cd919061090f565b60405180910390a15050565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa158015610236573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061025e91906107c2565b90505f60405180602001604052808481525090505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ef43e40d83856040518363ffffffff1660e01b81526004016102c292919061094f565b602060405180830381865afa1580156102dd573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061030191906108d5565b90507fab4abdf0d66655ed9c7e1ee2f2aff1d43dbdc0736a3e7078c2be95bcf380057581604051610332919061090f565b60405180910390a150505050565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa15801561039d573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906103c591906107c2565b90507f28b3d377892d8db500fb9a9bbd4731605ca2a642c3c62a7e64d47b7d42024368815f01516040516103f991906109cc565b60405180910390a150565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa158015610461573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061048991906107c2565b90505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b019204f836040518263ffffffff1660e01b81526004016104d99190610882565b602060405180830381865afa1580156104f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105189190610a29565b90507f23ce6861f26687742455d6955fcd53a5587ecf279e37422d0cd9636e2a2a9f7f816040516105499190610a63565b60405180910390a15050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6105b48261056e565b810181811067ffffffffffffffff821117156105d3576105d261057e565b5b80604052505050565b5f6105e5610555565b90506105f182826105ab565b919050565b5f67ffffffffffffffff8211156106105761060f61057e565b5b6106198261056e565b9050602081019050919050565b828183375f83830152505050565b5f610646610641846105f6565b6105dc565b9050828152602081018484840111156106625761066161056a565b5b61066d848285610626565b509392505050565b5f82601f83011261068957610688610566565b5b8135610699848260208601610634565b91505092915050565b5f602082840312156106b7576106b661055e565b5b5f82013567ffffffffffffffff8111156106d4576106d3610562565b5b6106e084828501610675565b91505092915050565b5f80fd5b5f80fd5b8281835e5f83830152505050565b5f61071161070c846105f6565b6105dc565b90508281526020810184848401111561072d5761072c61056a565b5b6107388482856106f1565b509392505050565b5f82601f83011261075457610753610566565b5b81516107648482602086016106ff565b91505092915050565b5f60208284031215610782576107816106e9565b5b61078c60206105dc565b90505f82015167ffffffffffffffff8111156107ab576107aa6106ed565b5b6107b784828501610740565b5f8301525092915050565b5f602082840312156107d7576107d661055e565b5b5f82015167ffffffffffffffff8111156107f4576107f3610562565b5b6108008482850161076d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f61082d82610809565b6108378185610813565b93506108478185602086016106f1565b6108508161056e565b840191505092915050565b5f602083015f8301518482035f8601526108758282610823565b9150508091505092915050565b5f6020820190508181035f83015261089a818461085b565b905092915050565b5f819050919050565b6108b4816108a2565b81146108be575f80fd5b50565b5f815190506108cf816108ab565b92915050565b5f602082840312156108ea576108e961055e565b5b5f6108f7848285016108c1565b91505092915050565b610909816108a2565b82525050565b5f6020820190506109225f830184610900565b92915050565b5f602083015f8301518482035f8601526109428282610823565b9150508091505092915050565b5f6040820190508181035f8301526109678185610928565b9050818103602083015261097b818461085b565b90509392505050565b5f82825260208201905092915050565b5f61099e82610809565b6109a88185610984565b93506109b88185602086016106f1565b6109c18161056e565b840191505092915050565b5f6020820190508181035f8301526109e48184610994565b905092915050565b5f67ffffffffffffffff82169050919050565b610a08816109ec565b8114610a12575f80fd5b50565b5f81519050610a23816109ff565b92915050565b5f60208284031215610a3e57610a3d61055e565b5b5f610a4b84828501610a15565b91505092915050565b610a5d816109ec565b82525050565b5f602082019050610a765f830184610a54565b9291505056fea26469706673582212201305cd24dc5a8f09ab0f20f7149275842101d3e9bbb235941608cb65e3574c9864736f6c634300081a0033 \ No newline at end of file +6080604052348015600e575f80fd5b50610ab28061001c5f395ff3fe608060405234801561000f575f80fd5b506004361061004a575f3560e01c806319a5506a1461004e57806341d9834c1461005857806390cdadcd14610074578063cdfd0a661461007e575b5f80fd5b610056610088565b005b610072600480360381019061006d91906106a2565b6101d9565b005b61007c610340565b005b610086610404565b005b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa1580156100e5573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061010d91906107c2565b90505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16630d90ec7b836040518263ffffffff1660e01b815260040161015d9190610882565b602060405180830381865afa158015610178573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061019c91906108d5565b90507f52c249d568f18754049ea99591153f1f0ad8c7ab03a3bcdcf8454bc274e54101816040516101cd919061090f565b60405180910390a15050565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa158015610236573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061025e91906107c2565b90505f60405180602001604052808481525090505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ef43e40d83856040518363ffffffff1660e01b81526004016102c292919061094f565b602060405180830381865afa1580156102dd573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061030191906108d5565b90507fab4abdf0d66655ed9c7e1ee2f2aff1d43dbdc0736a3e7078c2be95bcf380057581604051610332919061090f565b60405180910390a150505050565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa15801561039d573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906103c591906107c2565b90507f28b3d377892d8db500fb9a9bbd4731605ca2a642c3c62a7e64d47b7d42024368815f01516040516103f991906109cc565b60405180910390a150565b5f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f31317496040518163ffffffff1660e01b81526004015f60405180830381865afa158015610461573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061048991906107c2565b90505f73107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b019204f836040518263ffffffff1660e01b81526004016104d99190610882565b602060405180830381865afa1580156104f4573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105189190610a29565b90507f23ce6861f26687742455d6955fcd53a5587ecf279e37422d0cd9636e2a2a9f7f816040516105499190610a63565b60405180910390a15050565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6105b48261056e565b810181811067ffffffffffffffff821117156105d3576105d261057e565b5b80604052505050565b5f6105e5610555565b90506105f182826105ab565b919050565b5f67ffffffffffffffff8211156106105761060f61057e565b5b6106198261056e565b9050602081019050919050565b828183375f83830152505050565b5f610646610641846105f6565b6105dc565b9050828152602081018484840111156106625761066161056a565b5b61066d848285610626565b509392505050565b5f82601f83011261068957610688610566565b5b8135610699848260208601610634565b91505092915050565b5f602082840312156106b7576106b661055e565b5b5f82013567ffffffffffffffff8111156106d4576106d3610562565b5b6106e084828501610675565b91505092915050565b5f80fd5b5f80fd5b8281835e5f83830152505050565b5f61071161070c846105f6565b6105dc565b90508281526020810184848401111561072d5761072c61056a565b5b6107388482856106f1565b509392505050565b5f82601f83011261075457610753610566565b5b81516107648482602086016106ff565b91505092915050565b5f60208284031215610782576107816106e9565b5b61078c60206105dc565b90505f82015167ffffffffffffffff8111156107ab576107aa6106ed565b5b6107b784828501610740565b5f8301525092915050565b5f602082840312156107d7576107d661055e565b5b5f82015167ffffffffffffffff8111156107f4576107f3610562565b5b6108008482850161076d565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f61082d82610809565b6108378185610813565b93506108478185602086016106f1565b6108508161056e565b840191505092915050565b5f602083015f8301518482035f8601526108758282610823565b9150508091505092915050565b5f6020820190508181035f83015261089a818461085b565b905092915050565b5f819050919050565b6108b4816108a2565b81146108be575f80fd5b50565b5f815190506108cf816108ab565b92915050565b5f602082840312156108ea576108e961055e565b5b5f6108f7848285016108c1565b91505092915050565b610909816108a2565b82525050565b5f6020820190506109225f830184610900565b92915050565b5f602083015f8301518482035f8601526109428282610823565b9150508091505092915050565b5f6040820190508181035f8301526109678185610928565b9050818103602083015261097b818461085b565b90509392505050565b5f82825260208201905092915050565b5f61099e82610809565b6109a88185610984565b93506109b88185602086016106f1565b6109c18161056e565b840191505092915050565b5f6020820190508181035f8301526109e48184610994565b905092915050565b5f67ffffffffffffffff82169050919050565b610a08816109ec565b8114610a12575f80fd5b50565b5f81519050610a23816109ff565b92915050565b5f60208284031215610a3e57610a3d61055e565b5b5f610a4b84828501610a15565b91505092915050565b610a5d816109ec565b82525050565b5f602082019050610a765f830184610a54565b9291505056fea264697066735822122035f5baa21d01277289d823c7b01ade2835b8f18b1a701a088120e85e1c2fcc4d64736f6c63430008190033 \ No newline at end of file diff --git a/packages/evm/evmtest/wiki_how_tos/TakeAllowance.abi b/packages/evm/evmtest/wiki_how_tos/TakeAllowance.abi new file mode 100644 index 0000000000..d64b52703b --- /dev/null +++ b/packages/evm/evmtest/wiki_how_tos/TakeAllowance.abi @@ -0,0 +1,20 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_address", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_allowanceNFTID", + "type": "bytes32" + } + ], + "name": "takeAllowedFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] \ No newline at end of file diff --git a/packages/evm/evmtest/wiki_how_tos/TakeAllowance.bin b/packages/evm/evmtest/wiki_how_tos/TakeAllowance.bin new file mode 100644 index 0000000000..29ed10053f --- /dev/null +++ b/packages/evm/evmtest/wiki_how_tos/TakeAllowance.bin @@ -0,0 +1 @@ +6080604052348015600e575f80fd5b506105f18061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c806374e47c261461002d575b5f80fd5b61004760048036038101906100429190610204565b610049565b005b5f600167ffffffffffffffff81111561006557610064610242565b5b6040519080825280602002602001820160405280156100935781602001602082028036833780820191505090505b50905081815f815181106100aa576100a961026f565b5b6020026020010181815250506100be610149565b81816040018190525073107400000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663423fa15185836040518363ffffffff1660e01b815260040161011692919061058d565b5f604051808303815f87803b15801561012d575f80fd5b505af115801561013f573d5f803e3d5ffd5b5050505050505050565b60405180606001604052805f67ffffffffffffffff16815260200160608152602001606081525090565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101a082610177565b9050919050565b6101b081610196565b81146101ba575f80fd5b50565b5f813590506101cb816101a7565b92915050565b5f819050919050565b6101e3816101d1565b81146101ed575f80fd5b50565b5f813590506101fe816101da565b92915050565b5f806040838503121561021a57610219610173565b5b5f610227858286016101bd565b9250506020610238858286016101f0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6102a581610196565b82525050565b5f67ffffffffffffffff82169050919050565b6102c7816102ab565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f610338826102f6565b6103428185610300565b9350610352818560208601610310565b61035b8161031e565b840191505092915050565b5f602083015f8301518482035f860152610380828261032e565b9150508091505092915050565b5f819050919050565b61039f8161038d565b82525050565b5f604083015f8301518482035f8601526103bf8282610366565b91505060208301516103d46020860182610396565b508091505092915050565b5f6103ea83836103a5565b905092915050565b5f602082019050919050565b5f610408826102cd565b61041281856102d7565b935083602082028501610424856102e7565b805f5b8581101561045f578484038952815161044085826103df565b945061044b836103f2565b925060208a01995050600181019050610427565b50829750879550505050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6104a4826101d1565b9050919050565b6104b48161049a565b82525050565b5f6104c583836104ab565b60208301905092915050565b5f602082019050919050565b5f6104e782610471565b6104f1818561047b565b93506104fc8361048b565b805f5b8381101561052c57815161051388826104ba565b975061051e836104d1565b9250506001810190506104ff565b5085935050505092915050565b5f606083015f83015161054e5f8601826102be565b506020830151848203602086015261056682826103fe565b9150506040830151848203604086015261058082826104dd565b9150508091505092915050565b5f6040820190506105a05f83018561029c565b81810360208301526105b28184610539565b9050939250505056fea2646970667358221220bf3c29b84410618bfc25de63008609fdd69c89b0ebe6f626d04d0f6afe9756e764736f6c634300081a0033 \ No newline at end of file diff --git a/packages/evm/evmtest/wiki_how_tos/TakeAllowance.sol b/packages/evm/evmtest/wiki_how_tos/TakeAllowance.sol new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/evm/evmtest/wiki_how_tos/how_tos_test.go b/packages/evm/evmtest/wiki_how_tos/how_tos_test.go index 2d0186b217..0517089929 100644 --- a/packages/evm/evmtest/wiki_how_tos/how_tos_test.go +++ b/packages/evm/evmtest/wiki_how_tos/how_tos_test.go @@ -1,6 +1,7 @@ package wiki_how_tos_test import ( + "bytes" _ "embed" "math/big" "strings" @@ -16,13 +17,25 @@ import ( "github.com/iotaledger/wasp/packages/vm/core/evm/evmtest" ) -//go:generate sh -c "solc --abi --bin --overwrite @iscmagic=`realpath ../../../vm/core/evm/iscmagic` GetBalance.sol -o ." +//go:generate sh -c "solc --abi --bin --overwrite @iscmagic=`realpath ../../../vm/core/evm/iscmagic` GetBalance.sol TakeAllowance.sol Allowance.sol -o ." var ( //go:embed GetBalance.abi GetBalanceContractABI string //go:embed GetBalance.bin GetBalanceContractBytecodeHex string GetBalanceContractBytecode = common.FromHex(strings.TrimSpace(GetBalanceContractBytecodeHex)) + + //go:embed TakeAllowance.abi + TakeAllowanceContractABI string + //go:embed TakeAllowance.bin + TakeAllowanceContractBytecodeHex string + TakeAllowanceContractBytecode = common.FromHex(strings.TrimSpace(TakeAllowanceContractBytecodeHex)) + + //go:embed Allowance.abi + AllowanceContractABI string + //go:embed Allowance.bin + AllowanceContractBytecodeHex string + AllowanceContractBytecode = common.FromHex(strings.TrimSpace(AllowanceContractBytecodeHex)) ) func TestBaseBalance(t *testing.T) { @@ -112,3 +125,26 @@ func TestAgentID(t *testing.T) { instance.CallFnExpectEvent(nil, "GotAgentID", &agentID, "getAgentID") assert.Equal(t, senderAgentID.Bytes(), agentID) } + +func TestTakeAllowance(t *testing.T) { + env := evmtest.InitEVMWithSolo(t, solo.New(t), true) + privateKey, deployer := env.Chain.NewEthereumAccountWithL2Funds() + + allowanceInstance := env.DeployContract(privateKey, AllowanceContractABI, AllowanceContractBytecode) + + // creating nft ID + NFT_ID_Buffer := bytes.NewBufferString("0x0000000000000000000000000000000000000000000000000000000000000001") + NFT_ID := [32]byte(NFT_ID_Buffer.Bytes()) + + // allowing funds + result, err := allowanceInstance.CallFn(nil, "allow", deployer, NFT_ID) + assert.Nil(t, err) + + t.Log("****************************", result, err) + + takeAllowanceInstance := env.DeployContract(privateKey, TakeAllowanceContractABI, TakeAllowanceContractBytecode) + + // taking allowed funds + takeAllowanceInstance.CallFn(nil, "takeAllowedFunds", deployer, NFT_ID) + assert.Nil(t, err) +}